Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Description about Layout::array differs from std #451

Open
Luv-Ray opened this issue May 22, 2024 · 0 comments
Open

Description about Layout::array differs from std #451

Luv-Ray opened this issue May 22, 2024 · 0 comments

Comments

@Luv-Ray
Copy link

Luv-Ray commented May 22, 2024

As Layout::array's document said, when the total size would exceed isize::MAX, returns LayoutError. Not the usize::MAX.

// `Layout::array` checks that the number of bytes is <= usize::MAX,
// but this is redundant since old_layout.size() <= isize::MAX,
// so the `unwrap` should never fail.
let new_layout = Layout::array::<T>(new_cap).unwrap();
(new_cap, new_layout)

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

No branches or pull requests

1 participant