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;
7878mod num;
7979mod ops;
8080mod option;
81+ mod panic_safe;
8182mod pattern;
8283mod ptr;
8384mod result;
Original file line number Diff line number Diff line change 1- // run-pass
21#![ allow( dead_code) ]
32
4- use std:: panic:: { UnwindSafe , AssertUnwindSafe } ;
53use std:: cell:: RefCell ;
6- use std:: sync :: { Mutex , RwLock , Arc } ;
4+ use std:: panic :: { AssertUnwindSafe , UnwindSafe } ;
75use std:: rc:: Rc ;
6+ use std:: sync:: { Arc , Mutex , RwLock } ;
87
9- struct Foo { a : i32 }
8+ struct Foo {
9+ a : i32 ,
10+ }
1011
1112fn 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 > > ( ) ;
You can’t perform that action at this time.
0 commit comments