Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ac39deb

Browse files
committed
Move panic safety traits tests
1 parent ed52c7b commit ac39deb

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

library/core/tests/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ mod nonzero;
7878
mod num;
7979
mod ops;
8080
mod option;
81+
mod panic_safe;
8182
mod pattern;
8283
mod ptr;
8384
mod result;

src/test/ui/panics/panic-safe.rs renamed to library/core/tests/panic_safe.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
// run-pass
21
#![allow(dead_code)]
32

4-
use std::panic::{UnwindSafe, AssertUnwindSafe};
53
use std::cell::RefCell;
6-
use std::sync::{Mutex, RwLock, Arc};
4+
use std::panic::{AssertUnwindSafe, UnwindSafe};
75
use std::rc::Rc;
6+
use std::sync::{Arc, Mutex, RwLock};
87

9-
struct Foo { a: i32 }
8+
struct Foo {
9+
a: i32,
10+
}
1011

1112
fn assert<T: UnwindSafe + ?Sized>() {}
1213

13-
fn main() {
14+
#[test]
15+
fn test_panic_safety_traits() {
1416
assert::<i32>();
1517
assert::<&i32>();
1618
assert::<*mut i32>();
@@ -32,13 +34,16 @@ fn main() {
3234
assert::<Arc<i32>>();
3335
assert::<Box<[u8]>>();
3436

35-
trait Trait: UnwindSafe {}
36-
assert::<Box<dyn Trait>>();
37+
{
38+
trait Trait: UnwindSafe {}
39+
assert::<Box<dyn Trait>>();
40+
}
3741

3842
fn bar<T>() {
3943
assert::<Mutex<T>>();
4044
assert::<RwLock<T>>();
4145
}
46+
4247
fn baz<T: UnwindSafe>() {
4348
assert::<Box<T>>();
4449
assert::<Vec<T>>();

0 commit comments

Comments
 (0)