File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -712,9 +712,31 @@ pub fn _eprint(args: fmt::Arguments) {
712
712
713
713
#[ cfg( test) ]
714
714
mod tests {
715
+ use panic:: { UnwindSafe , RefUnwindSafe } ;
715
716
use thread;
716
717
use super :: * ;
717
718
719
+ #[ test]
720
+ fn stdout_unwind_safe ( ) {
721
+ assert_unwind_safe :: < Stdout > ( ) ;
722
+ }
723
+ #[ test]
724
+ fn stdoutlock_unwind_safe ( ) {
725
+ assert_unwind_safe :: < StdoutLock > ( ) ;
726
+ assert_unwind_safe :: < StdoutLock < ' static > > ( ) ;
727
+ }
728
+ #[ test]
729
+ fn stderr_unwind_safe ( ) {
730
+ assert_unwind_safe :: < Stderr > ( ) ;
731
+ }
732
+ #[ test]
733
+ fn stderrlock_unwind_safe ( ) {
734
+ assert_unwind_safe :: < StderrLock > ( ) ;
735
+ assert_unwind_safe :: < StderrLock < ' static > > ( ) ;
736
+ }
737
+
738
+ fn assert_unwind_safe < T : UnwindSafe + RefUnwindSafe > ( ) { }
739
+
718
740
#[ test]
719
741
#[ cfg_attr( target_os = "emscripten" , ignore) ]
720
742
fn panic_doesnt_poison ( ) {
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ use marker;
13
13
use ops:: Deref ;
14
14
use sys_common:: poison:: { self , TryLockError , TryLockResult , LockResult } ;
15
15
use sys:: mutex as sys;
16
+ use panic:: { UnwindSafe , RefUnwindSafe } ;
16
17
17
18
/// A re-entrant mutual exclusion
18
19
///
@@ -28,6 +29,9 @@ pub struct ReentrantMutex<T> {
28
29
unsafe impl < T : Send > Send for ReentrantMutex < T > { }
29
30
unsafe impl < T : Send > Sync for ReentrantMutex < T > { }
30
31
32
+ impl < T > UnwindSafe for ReentrantMutex < T > { }
33
+ impl < T > RefUnwindSafe for ReentrantMutex < T > { }
34
+
31
35
32
36
/// An RAII implementation of a "scoped lock" of a mutex. When this structure is
33
37
/// dropped (falls out of scope), the lock will be unlocked.
You can’t perform that action at this time.
0 commit comments