Skip to content

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Oct 4, 2022

See rust-lang/rust#101899. rust-lang/rust#95295, which looks like it is going to be un-reverted, makes the following change to the error condition of Layout::from_size_align and thus the safety requirement of Layout::from_size_align_unchecked:

     /// * `size`, when rounded up to the nearest multiple of `align`,
-    ///    must not overflow (i.e., the rounded value must be less than
-    ///    or equal to `usize::MAX`).
+    ///    must not overflow isize (i.e., the rounded value must be
+    ///    less than or equal to `isize::MAX`).

    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;
        |                                     ^^^^^^^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant