about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2022-07-09 19:53:21 -0400
committerBen Kimock <kimockb@gmail.com>2022-07-13 09:24:19 -0400
commit7d9f04f7a8b3ef3c0e00a50e58f86fa8d8cf34ea (patch)
tree35adda3163efad0672449e5f5f4dc3081c16582c
parentdb5a2b97475166626e4c7680844f47f5347e9bc3 (diff)
downloadrust-7d9f04f7a8b3ef3c0e00a50e58f86fa8d8cf34ea.tar.gz
rust-7d9f04f7a8b3ef3c0e00a50e58f86fa8d8cf34ea.zip
Add a benchmark of the hang-on-test-failure code path
-rw-r--r--bench-cargo-miri/slice-get-unchecked/Cargo.lock7
-rw-r--r--bench-cargo-miri/slice-get-unchecked/Cargo.toml8
-rw-r--r--bench-cargo-miri/slice-get-unchecked/src/main.rs12
3 files changed, 27 insertions, 0 deletions
diff --git a/bench-cargo-miri/slice-get-unchecked/Cargo.lock b/bench-cargo-miri/slice-get-unchecked/Cargo.lock
new file mode 100644
index 00000000000..a375afaed30
--- /dev/null
+++ b/bench-cargo-miri/slice-get-unchecked/Cargo.lock
@@ -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"
diff --git a/bench-cargo-miri/slice-get-unchecked/Cargo.toml b/bench-cargo-miri/slice-get-unchecked/Cargo.toml
new file mode 100644
index 00000000000..1ac2276866f
--- /dev/null
+++ b/bench-cargo-miri/slice-get-unchecked/Cargo.toml
@@ -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]
diff --git a/bench-cargo-miri/slice-get-unchecked/src/main.rs b/bench-cargo-miri/slice-get-unchecked/src/main.rs
new file mode 100644
index 00000000000..a72083bd9de
--- /dev/null
+++ b/bench-cargo-miri/slice-get-unchecked/src/main.rs
@@ -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;
+    }
+}