This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ mod nonzero;
78
78
mod num;
79
79
mod ops;
80
80
mod option;
81
+ mod panic_safe;
81
82
mod pattern;
82
83
mod ptr;
83
84
mod result;
Original file line number Diff line number Diff line change 1
- // run-pass
2
1
#![ allow( dead_code) ]
3
2
4
- use std:: panic:: { UnwindSafe , AssertUnwindSafe } ;
5
3
use std:: cell:: RefCell ;
6
- use std:: sync :: { Mutex , RwLock , Arc } ;
4
+ use std:: panic :: { AssertUnwindSafe , UnwindSafe } ;
7
5
use std:: rc:: Rc ;
6
+ use std:: sync:: { Arc , Mutex , RwLock } ;
8
7
9
- struct Foo { a : i32 }
8
+ struct Foo {
9
+ a : i32 ,
10
+ }
10
11
11
12
fn assert < T : UnwindSafe + ?Sized > ( ) { }
12
13
13
- fn main ( ) {
14
+ #[ test]
15
+ fn test_panic_safety_traits ( ) {
14
16
assert :: < i32 > ( ) ;
15
17
assert :: < & i32 > ( ) ;
16
18
assert :: < * mut i32 > ( ) ;
@@ -32,13 +34,16 @@ fn main() {
32
34
assert :: < Arc < i32 > > ( ) ;
33
35
assert :: < Box < [ u8 ] > > ( ) ;
34
36
35
- trait Trait : UnwindSafe { }
36
- assert :: < Box < dyn Trait > > ( ) ;
37
+ {
38
+ trait Trait : UnwindSafe { }
39
+ assert :: < Box < dyn Trait > > ( ) ;
40
+ }
37
41
38
42
fn bar < T > ( ) {
39
43
assert :: < Mutex < T > > ( ) ;
40
44
assert :: < RwLock < T > > ( ) ;
41
45
}
46
+
42
47
fn baz < T : UnwindSafe > ( ) {
43
48
assert :: < Box < T > > ( ) ;
44
49
assert :: < Vec < T > > ( ) ;
You can’t perform that action at this time.
0 commit comments