Skip to content

Commit 07583b1

Browse files
authored
Merge pull request #77 from jannic-dev-forks/const-is-stable
Remove features `const_mut_refs` and `use_spin_nightly`
2 parents c2aa6ec + 711a8e9 commit 07583b1

File tree

5 files changed

+12
-38
lines changed

5 files changed

+12
-38
lines changed

Cargo.toml

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ repository = "https://github.com/phil-opp/linked-list-allocator"
1111
documentation = "https://docs.rs/crate/linked_list_allocator"
1212
homepage = "http://os.phil-opp.com/kernel-heap.html#a-better-allocator"
1313

14+
rust-version = "1.61"
15+
1416
[features]
15-
default = ["use_spin_nightly"]
17+
default = ["use_spin"]
1618
use_spin = ["spinning_top"]
17-
use_spin_nightly = ["use_spin", "spinning_top/nightly", "const_mut_refs"]
19+
# deprecated - use `use_spin` instead
20+
use_spin_nightly = ["use_spin"]
1821
alloc_ref = []
22+
# deprecated - no effect
1923
const_mut_refs = []
2024

2125
[dependencies.spinning_top]
22-
version = "0.2.3"
26+
version = "0.2.5"
2327
optional = true
2428

2529
[package.metadata.release]

Changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Unreleased
22

3+
- Remove features const_mut_refs and use_spin_nightly. Since rust 1.61, the underlying const functions are available in stable rust,
4+
and lock_api >= 0.4.7 automatically uses them. (Feature const_fn_trait_bound, https://github.com/rust-lang/rust/pull/93827)
5+
To avoid a breaking change, the features are still listed in Cargo.toml, but have no effect and are marked as deprecated.
6+
This bumps the minimum supported rust version to 1.61.
7+
38
# 0.10.4 – 2022-10-10
49

510
- Fix [memory leak of small back paddings](https://github.com/rust-osdev/linked-list-allocator/issues/66) by considering regions that would result in such small back paddings as unsuitable ([#71](https://github.com/rust-osdev/linked-list-allocator/pull/71))

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ pub fn init_heap() {
3131
## Features
3232

3333
- **`use_spin`** (default): Provide a `LockedHeap` type that implements the [`GlobalAlloc`] trait by using a spinlock.
34-
- **`const_mut_refs`** (default): Makes the `Heap::empty` function `const`; requires nightly Rust.
35-
- **`use_spin_nightly`** (default): Makes the `LockedHeap::empty` function `const`, automatically enables `use_spin` and `const_mut_refs`; requires nightly Rust.
3634
- **`alloc_ref`**: Provide an implementation of the unstable [`AllocRef`] trait; requires nightly Rust.
3735
- Warning: The `AllocRef` trait is still regularly changed on the Rust side, so expect some regular breakage when using this feature.
3836

src/hole.rs

-15
Original file line numberDiff line numberDiff line change
@@ -257,21 +257,6 @@ fn check_merge_bottom(node: NonNull<Hole>, bottom: *mut u8) -> NonNull<Hole> {
257257

258258
impl HoleList {
259259
/// Creates an empty `HoleList`.
260-
#[cfg(not(feature = "const_mut_refs"))]
261-
pub fn empty() -> HoleList {
262-
HoleList {
263-
first: Hole {
264-
size: 0,
265-
next: None,
266-
},
267-
bottom: null_mut(),
268-
top: null_mut(),
269-
pending_extend: 0,
270-
}
271-
}
272-
273-
/// Creates an empty `HoleList`.
274-
#[cfg(feature = "const_mut_refs")]
275260
pub const fn empty() -> HoleList {
276261
HoleList {
277262
first: Hole {

src/lib.rs

-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![cfg_attr(feature = "const_mut_refs", feature(const_mut_refs))]
21
#![cfg_attr(
32
feature = "alloc_ref",
43
feature(allocator_api, alloc_layout_extra, nonnull_slice_from_raw_parts)
@@ -55,15 +54,6 @@ unsafe impl Send for Heap {}
5554

5655
impl Heap {
5756
/// Creates an empty heap. All allocate calls will return `None`.
58-
#[cfg(not(feature = "const_mut_refs"))]
59-
pub fn empty() -> Heap {
60-
Heap {
61-
used: 0,
62-
holes: HoleList::empty(),
63-
}
64-
}
65-
66-
#[cfg(feature = "const_mut_refs")]
6757
pub const fn empty() -> Heap {
6858
Heap {
6959
used: 0,
@@ -300,18 +290,10 @@ pub struct LockedHeap(Spinlock<Heap>);
300290

301291
#[cfg(feature = "use_spin")]
302292
impl LockedHeap {
303-
/// Creates an empty heap. All allocate calls will return `None`.
304-
#[cfg(feature = "use_spin_nightly")]
305293
pub const fn empty() -> LockedHeap {
306294
LockedHeap(Spinlock::new(Heap::empty()))
307295
}
308296

309-
/// Creates an empty heap. All allocate calls will return `None`.
310-
#[cfg(not(feature = "use_spin_nightly"))]
311-
pub fn empty() -> LockedHeap {
312-
LockedHeap(Spinlock::new(Heap::empty()))
313-
}
314-
315297
/// Creates a new heap with the given `bottom` and `size`.
316298
///
317299
/// The `heap_bottom` pointer is automatically aligned, so the [`bottom()`][Heap::bottom]

0 commit comments

Comments
 (0)