@@ -6,9 +6,10 @@ use crate::cell::RefCell;
6
6
use crate :: fmt;
7
7
use crate :: io:: lazy:: Lazy ;
8
8
use crate :: io:: { self , Initializer , BufReader , LineWriter } ;
9
- use crate :: sync:: { Arc , Mutex , MutexGuard } ;
9
+ use crate :: sync:: Arc ;
10
10
use crate :: sys:: stdio;
11
- use crate :: sys_common:: remutex:: { ReentrantMutex , ReentrantMutexGuard } ;
11
+ use crate :: panic:: { UnwindSafe , RefUnwindSafe } ;
12
+ use crate :: parking_lot:: { Mutex , MutexGuard , ReentrantMutex , ReentrantMutexGuard } ;
12
13
use crate :: thread:: LocalKey ;
13
14
14
15
thread_local ! {
@@ -256,7 +257,7 @@ impl Stdin {
256
257
/// ```
257
258
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
258
259
pub fn lock ( & self ) -> StdinLock < ' _ > {
259
- StdinLock { inner : self . inner . lock ( ) . unwrap_or_else ( |e| e . into_inner ( ) ) }
260
+ StdinLock { inner : self . inner . lock ( ) }
260
261
}
261
262
262
263
/// Locks this handle and reads a line of input into the specified buffer.
@@ -467,7 +468,7 @@ impl Stdout {
467
468
/// ```
468
469
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
469
470
pub fn lock ( & self ) -> StdoutLock < ' _ > {
470
- StdoutLock { inner : self . inner . lock ( ) . unwrap_or_else ( |e| e . into_inner ( ) ) }
471
+ StdoutLock { inner : self . inner . lock ( ) }
471
472
}
472
473
}
473
474
@@ -493,6 +494,12 @@ impl Write for Stdout {
493
494
self . lock ( ) . write_fmt ( args)
494
495
}
495
496
}
497
+
498
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
499
+ impl UnwindSafe for Stdout { }
500
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
501
+ impl RefUnwindSafe for Stdout { }
502
+
496
503
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
497
504
impl Write for StdoutLock < ' _ > {
498
505
fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
@@ -510,6 +517,11 @@ impl fmt::Debug for StdoutLock<'_> {
510
517
}
511
518
}
512
519
520
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
521
+ impl UnwindSafe for StdoutLock < ' _ > { }
522
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
523
+ impl RefUnwindSafe for StdoutLock < ' _ > { }
524
+
513
525
/// A handle to the standard error stream of a process.
514
526
///
515
527
/// For more information, see the [`io::stderr`] method.
@@ -620,7 +632,7 @@ impl Stderr {
620
632
/// ```
621
633
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
622
634
pub fn lock ( & self ) -> StderrLock < ' _ > {
623
- StderrLock { inner : self . inner . lock ( ) . unwrap_or_else ( |e| e . into_inner ( ) ) }
635
+ StderrLock { inner : self . inner . lock ( ) }
624
636
}
625
637
}
626
638
@@ -646,6 +658,12 @@ impl Write for Stderr {
646
658
self . lock ( ) . write_fmt ( args)
647
659
}
648
660
}
661
+
662
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
663
+ impl UnwindSafe for Stderr { }
664
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
665
+ impl RefUnwindSafe for Stderr { }
666
+
649
667
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
650
668
impl Write for StderrLock < ' _ > {
651
669
fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
@@ -663,6 +681,11 @@ impl fmt::Debug for StderrLock<'_> {
663
681
}
664
682
}
665
683
684
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
685
+ impl UnwindSafe for StderrLock < ' _ > { }
686
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
687
+ impl RefUnwindSafe for StderrLock < ' _ > { }
688
+
666
689
/// Resets the thread-local stderr handle to the specified writer
667
690
///
668
691
/// This will replace the current thread's stderr handle, returning the old
@@ -767,7 +790,6 @@ pub use realstd::io::{_eprint, _print};
767
790
768
791
#[ cfg( test) ]
769
792
mod tests {
770
- use crate :: panic:: { UnwindSafe , RefUnwindSafe } ;
771
793
use crate :: thread;
772
794
use super :: * ;
773
795
0 commit comments