@@ -8,10 +8,9 @@ use crate::io::prelude::*;
8
8
use crate :: cell:: { Cell , RefCell } ;
9
9
use crate :: fmt;
10
10
use crate :: io:: { self , BufReader , IoSlice , IoSliceMut , LineWriter , Lines } ;
11
- use crate :: lazy:: SyncOnceCell ;
12
11
use crate :: pin:: Pin ;
13
12
use crate :: sync:: atomic:: { AtomicBool , Ordering } ;
14
- use crate :: sync:: { Arc , Mutex , MutexGuard } ;
13
+ use crate :: sync:: { Arc , Mutex , MutexGuard , OnceLock } ;
15
14
use crate :: sys:: stdio;
16
15
use crate :: sys_common:: remutex:: { ReentrantMutex , ReentrantMutexGuard } ;
17
16
@@ -318,7 +317,7 @@ pub struct StdinLock<'a> {
318
317
#[ must_use]
319
318
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
320
319
pub fn stdin ( ) -> Stdin {
321
- static INSTANCE : SyncOnceCell < Mutex < BufReader < StdinRaw > > > = SyncOnceCell :: new ( ) ;
320
+ static INSTANCE : OnceLock < Mutex < BufReader < StdinRaw > > > = OnceLock :: new ( ) ;
322
321
Stdin {
323
322
inner : INSTANCE . get_or_init ( || {
324
323
Mutex :: new ( BufReader :: with_capacity ( stdio:: STDIN_BUF_SIZE , stdin_raw ( ) ) )
@@ -552,7 +551,7 @@ pub struct StdoutLock<'a> {
552
551
inner : ReentrantMutexGuard < ' a , RefCell < LineWriter < StdoutRaw > > > ,
553
552
}
554
553
555
- static STDOUT : SyncOnceCell < ReentrantMutex < RefCell < LineWriter < StdoutRaw > > > > = SyncOnceCell :: new ( ) ;
554
+ static STDOUT : OnceLock < ReentrantMutex < RefCell < LineWriter < StdoutRaw > > > > = OnceLock :: new ( ) ;
556
555
557
556
/// Constructs a new handle to the standard output of the current process.
558
557
///
@@ -837,7 +836,7 @@ pub fn stderr() -> Stderr {
837
836
// Note that unlike `stdout()` we don't use `at_exit` here to register a
838
837
// destructor. Stderr is not buffered , so there's no need to run a
839
838
// destructor for flushing the buffer
840
- static INSTANCE : SyncOnceCell < ReentrantMutex < RefCell < StderrRaw > > > = SyncOnceCell :: new ( ) ;
839
+ static INSTANCE : OnceLock < ReentrantMutex < RefCell < StderrRaw > > > = OnceLock :: new ( ) ;
841
840
842
841
Stderr {
843
842
inner : Pin :: static_ref ( & INSTANCE ) . get_or_init_pin (
0 commit comments