Add a benchmark of the hang-on-test-failure code path
This commit is contained in:
parent
db5a2b9747
commit
7d9f04f7a8
3 changed files with 27 additions and 0 deletions
7
bench-cargo-miri/slice-get-unchecked/Cargo.lock
generated
Normal file
7
bench-cargo-miri/slice-get-unchecked/Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slice-get-unchecked"
|
||||||
|
version = "0.1.0"
|
8
bench-cargo-miri/slice-get-unchecked/Cargo.toml
Normal file
8
bench-cargo-miri/slice-get-unchecked/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "slice-get-unchecked"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
12
bench-cargo-miri/slice-get-unchecked/src/main.rs
Normal file
12
bench-cargo-miri/slice-get-unchecked/src/main.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
//! This is a stripped-down version of the code pattern that causes runtime blowup when printing
|
||||||
|
//! backtraces in a failed test under cargo miri test with -Zmiri-disable-isolation.
|
||||||
|
//! See https://github.com/rust-lang/miri/issues/2273
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let x = vec![0u8; 4096];
|
||||||
|
let mut i = 0;
|
||||||
|
while i < x.len() {
|
||||||
|
let _element = unsafe { *x.get_unchecked(i) };
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue