Skip to content

Conversation

@fpdotmonkey
Copy link
Contributor

Layout::array was updated in rust-lang/rust@a32305a8 to check that array sizes fit in isize::MAX, so I've propogated the change to vec-alloc here.

Layout::array was updated in rust-lang/rust@a32305a8
to check that array sizes fit in isize::MAX, so I've propogated the
change to vec-alloc here.
@fpdotmonkey
Copy link
Contributor Author

I'm curious if the expect could be moved into the else block. This would mean you wouldn't get the nice error message for the case of [T; 1] where size_of::<T>() > isize::MAX, but is that actually possible to make?

@scottmcm
Copy link
Member

scottmcm commented Nov 8, 2025

Correct, no allocation or type in rust can have size greater than isize::MAX -- that's how the alloc::Layout type can use the unchecked constructor from size_of+align_of.

Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

@JohnTitor JohnTitor added this pull request to the merge queue Nov 11, 2025
Merged via the queue into rust-lang:master with commit 28f4ae6 Nov 11, 2025
2 checks passed
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.

3 participants