diff --git a/src/raw.rs b/src/raw.rs index bb031da..ec2a6ec 100644 --- a/src/raw.rs +++ b/src/raw.rs @@ -310,7 +310,7 @@ where // If the task is not running, now is the time to schedule. if state & RUNNING == 0 { // If the reference count overflowed, abort. - if state > isize::max_value() as usize { + if state > isize::MAX as usize { abort(); } @@ -340,7 +340,7 @@ where let state = (*raw.header).state.fetch_add(REFERENCE, Ordering::Relaxed); // If the reference count overflowed, abort. - if state > isize::max_value() as usize { + if state > isize::MAX as usize { abort(); } diff --git a/src/utils.rs b/src/utils.rs index 189e9af..5c2170c 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -83,7 +83,7 @@ impl Layout { /// Returns the layout for `a` followed by `b` and the offset of `b`. /// - /// This function was adapted from the currently unstable `Layout::extend()`: + /// This function was adapted from the `Layout::extend()`: /// https://doc.rust-lang.org/nightly/std/alloc/struct.Layout.html#method.extend #[inline] pub(crate) const fn extend(self, other: Layout) -> Option<(Layout, usize)> { @@ -97,7 +97,7 @@ impl Layout { // - align is 0 (implied false by is_power_of_two()) // - align is not a power of 2 // - size rounded up to align overflows - if !new_align.is_power_of_two() || new_size > core::usize::MAX - (new_align - 1) { + if !new_align.is_power_of_two() || new_size > isize::MAX as usize - (new_align - 1) { return None; } @@ -107,7 +107,7 @@ impl Layout { /// Returns the padding after `layout` that aligns the following address to `align`. /// - /// This function was adapted from the currently unstable `Layout::padding_needed_for()`: + /// This function was adapted from the `Layout::padding_needed_for()`: /// https://doc.rust-lang.org/nightly/std/alloc/struct.Layout.html#method.padding_needed_for #[inline] pub(crate) const fn padding_needed_for(self, align: usize) -> usize {