fitzgen / bumpalo

A fast bump allocation arena for Rust
https://docs.rs/bumpalo
Apache License 2.0
1.35k stars 110 forks source link

`oom_instead_of_bump_pointer_overflow` test breakage on `nightly-2022-07-11` #174

Closed Eliasin closed 1 year ago

Eliasin commented 2 years ago

The oom_instead_of_bump_pointer_overflow test fails on nightly-2022-07-11 because of an upstream change to rustc to restrict the size passed to Layout::from_size_align to be within isize::MAX instead of usize::MAX. Since this test uses usize::MAX - p + 1 as a parameter to ensure overflow, this test now fails because of the call to Layout::from_size_align failing.

Eliasin commented 2 years ago

Changing

let size = usize::MAX - p + 1;

to

let size = (isize::MAX as usize) - p + 1;

on line 74 of tests.rs gets the test to pass. While I think due to the requirement that the panic be a out of memory panic specifically, this change should induce the correct test behavior but I'm not super sure what counts as overflow and whether or not (isize::MAX as usize) - p + 1 would also guarantee overflow so I'm holding off on creating a PR for this.

CAD97 commented 2 years ago

See also context in https://github.com/fitzgen/bumpalo/issues/128 the test seems to be a poor nondeterministic test to begin with.