run alloc benchmarks in Miri and fix UB#104097
Conversation
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
This comment has been minimized.
This comment has been minimized.
thomcc
left a comment
There was a problem hiding this comment.
Mildly cursed but it's inside unit-testsbenches so, fine.
| let mut deq = VecDeque::<i32>::with_capacity(size + 1); | ||
| // We'll mess with private state to pretend like `deq` is filled. | ||
| // Make sure the buffer is initialized so that we don't read uninit memory. | ||
| unsafe { deq.ptr().write_bytes(0u8, size + 1) }; |
There was a problem hiding this comment.
Not more cursed than just setting the head and tail fields without doing this...
I considered creating a filled VecDeque from an array, but that seems to me like it'd make even more assumptions about internal implementation details...
|
@bors r+ rollup |
run alloc benchmarks in Miri and fix UB Miri since recently has a "fake monotonic clock" that works even with isolation. Its measurements are not very meaningful but it means we can run these benches and check them for UB. And that's a good thing since there was UB here: fixes rust-lang#104096. r? `@thomcc`
…llaumeGomez Rollup of 12 pull requests Successful merges: - rust-lang#103928 (Add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed') - rust-lang#104027 (Place config.toml in current working directory if config not found) - rust-lang#104093 (disable btree size tests on Miri) - rust-lang#104097 (run alloc benchmarks in Miri and fix UB) - rust-lang#104104 (Add split-debuginfo print option) - rust-lang#104109 (rustdoc: Add mutable to the description) - rust-lang#104113 (Fix `const_fn_trait_ref_impl`, add test for it) - rust-lang#104114 (Fix invalid background-image file name) - rust-lang#104132 (fix: lint against lint functions) - rust-lang#104139 (Clarify licensing situation of MPSC and SPSC queue) - rust-lang#104147 (Remove an address comparison from the parser) - rust-lang#104165 (Add llvm-main to triagebot.toml) Failed merges: - rust-lang#104115 (Migrate crate-search element to CSS variables) r? `@ghost` `@rustbot` modify labels: rollup
Miri since recently has a "fake monotonic clock" that works even with isolation. Its measurements are not very meaningful but it means we can run these benches and check them for UB.
And that's a good thing since there was UB here: fixes #104096.
r? @thomcc