Skip to content

Commit

Permalink
Restore compatibility with rustc older than 1.43
Browse files Browse the repository at this point in the history
    error[E0599]: no associated item named `MAX` found for type `isize` in the current scope
       --> src/identifier.rs:106:37
        |
    106 |         debug_assert!(len <= isize::MAX as usize);
        |                                     ^^^ associated item not found in `isize`
        |
    help: you are looking for the module in `std`, not the primitive type
        |
    106 |         debug_assert!(len <= std::isize::MAX as usize);
        |                              ^^^^^^^^^^^^^^^

    error[E0599]: no associated item named `MAX` found for type `usize` in the current scope
       --> src/identifier.rs:132:44
        |
    132 |                     let max_alloc = usize::MAX / 2 - align;
        |                                            ^^^ associated item not found in `usize`
        |
    help: you are looking for the module in `std`, not the primitive type
        |
    132 |                     let max_alloc = std::usize::MAX / 2 - align;
        |                                     ^^^^^^^^^^^^^^^
  • Loading branch information
dtolnay committed Oct 4, 2022
1 parent 02a9ca8 commit 6b0af67
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@
// allows size_of::<Version>() == size_of::<Option<Version>>().

use crate::alloc::alloc::{alloc, dealloc, handle_alloc_error, Layout};
use core::isize;
use core::mem;
use core::num::{NonZeroU64, NonZeroUsize};
use core::ptr::{self, NonNull};
use core::slice;
use core::str;
use core::usize;

const PTR_BYTES: usize = mem::size_of::<NonNull<u8>>();

Expand Down

0 comments on commit 6b0af67

Please sign in to comment.