about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCharisee <chiw@google.com>2022-02-04 21:55:22 +0000
committerCharisee <chiw@google.com>2022-02-10 22:10:08 +0000
commita889079b29ee8204ea4cf19842bc759e676a2937 (patch)
tree88a33f9d9819322c11d6a6b5f373525be37da06c
parentd018a8b6248a15e871c2220296c1fa639d6267c6 (diff)
downloadrust-a889079b29ee8204ea4cf19842bc759e676a2937.tar.gz
rust-a889079b29ee8204ea4cf19842bc759e676a2937.zip
add cfg_panic bootstrap
-rw-r--r--library/core/tests/array.rs3
-rw-r--r--library/core/tests/iter/adapters/zip.rs1
-rw-r--r--library/core/tests/mem.rs2
3 files changed, 6 insertions, 0 deletions
diff --git a/library/core/tests/array.rs b/library/core/tests/array.rs
index ee8435e6d6c..a778779c0fd 100644
--- a/library/core/tests/array.rs
+++ b/library/core/tests/array.rs
@@ -392,6 +392,7 @@ fn array_try_from_fn() {
     assert_eq!(another_array, Err(SomeError::Foo));
 }
 
+#[cfg(not(panic = "abort"))]
 #[test]
 fn array_try_from_fn_drops_inserted_elements_on_err() {
     static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
@@ -415,6 +416,7 @@ fn array_try_from_fn_drops_inserted_elements_on_err() {
     assert_eq!(DROP_COUNTER.load(Ordering::SeqCst), 2);
 }
 
+#[cfg(not(panic = "abort"))]
 #[test]
 fn array_try_from_fn_drops_inserted_elements_on_panic() {
     static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
@@ -438,6 +440,7 @@ fn array_try_from_fn_drops_inserted_elements_on_panic() {
     assert_eq!(DROP_COUNTER.load(Ordering::SeqCst), 2);
 }
 
+#[cfg(not(panic = "abort"))]
 // https://stackoverflow.com/a/59211505
 fn catch_unwind_silent<F, R>(f: F) -> std::thread::Result<R>
 where
diff --git a/library/core/tests/iter/adapters/zip.rs b/library/core/tests/iter/adapters/zip.rs
index 58563e2061c..585cfbb90e4 100644
--- a/library/core/tests/iter/adapters/zip.rs
+++ b/library/core/tests/iter/adapters/zip.rs
@@ -233,6 +233,7 @@ fn test_zip_trusted_random_access_composition() {
 }
 
 #[test]
+#[cfg(panic = "unwind")]
 fn test_zip_trusted_random_access_next_back_drop() {
     use std::panic::catch_unwind;
     use std::panic::AssertUnwindSafe;
diff --git a/library/core/tests/mem.rs b/library/core/tests/mem.rs
index f878017c977..3b13dc0832f 100644
--- a/library/core/tests/mem.rs
+++ b/library/core/tests/mem.rs
@@ -1,5 +1,6 @@
 use core::mem::*;
 
+#[cfg(panic = "unwind")]
 use std::rc::Rc;
 
 #[test]
@@ -189,6 +190,7 @@ fn uninit_write_slice_cloned_panic_gt() {
 }
 
 #[test]
+#[cfg(panic = "unwind")]
 fn uninit_write_slice_cloned_mid_panic() {
     use std::panic;