Skip to content

Commit 0791daa

Browse files
committed
Move/rename lazy::Sync{OnceCell,Lazy} to sync::{Once,Lazy}Lock
1 parent 5a64ebf commit 0791daa

File tree

9 files changed

+795
-771
lines changed

9 files changed

+795
-771
lines changed

std/src/io/stdio.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ use crate::io::prelude::*;
88
use crate::cell::{Cell, RefCell};
99
use crate::fmt;
1010
use crate::io::{self, BufReader, IoSlice, IoSliceMut, LineWriter, Lines};
11-
use crate::lazy::SyncOnceCell;
1211
use crate::pin::Pin;
1312
use crate::sync::atomic::{AtomicBool, Ordering};
14-
use crate::sync::{Arc, Mutex, MutexGuard};
13+
use crate::sync::{Arc, Mutex, MutexGuard, OnceLock};
1514
use crate::sys::stdio;
1615
use crate::sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard};
1716

@@ -318,7 +317,7 @@ pub struct StdinLock<'a> {
318317
#[must_use]
319318
#[stable(feature = "rust1", since = "1.0.0")]
320319
pub fn stdin() -> Stdin {
321-
static INSTANCE: SyncOnceCell<Mutex<BufReader<StdinRaw>>> = SyncOnceCell::new();
320+
static INSTANCE: OnceLock<Mutex<BufReader<StdinRaw>>> = OnceLock::new();
322321
Stdin {
323322
inner: INSTANCE.get_or_init(|| {
324323
Mutex::new(BufReader::with_capacity(stdio::STDIN_BUF_SIZE, stdin_raw()))
@@ -552,7 +551,7 @@ pub struct StdoutLock<'a> {
552551
inner: ReentrantMutexGuard<'a, RefCell<LineWriter<StdoutRaw>>>,
553552
}
554553

555-
static STDOUT: SyncOnceCell<ReentrantMutex<RefCell<LineWriter<StdoutRaw>>>> = SyncOnceCell::new();
554+
static STDOUT: OnceLock<ReentrantMutex<RefCell<LineWriter<StdoutRaw>>>> = OnceLock::new();
556555

557556
/// Constructs a new handle to the standard output of the current process.
558557
///
@@ -837,7 +836,7 @@ pub fn stderr() -> Stderr {
837836
// Note that unlike `stdout()` we don't use `at_exit` here to register a
838837
// destructor. Stderr is not buffered , so there's no need to run a
839838
// destructor for flushing the buffer
840-
static INSTANCE: SyncOnceCell<ReentrantMutex<RefCell<StderrRaw>>> = SyncOnceCell::new();
839+
static INSTANCE: OnceLock<ReentrantMutex<RefCell<StderrRaw>>> = OnceLock::new();
841840

842841
Stderr {
843842
inner: Pin::static_ref(&INSTANCE).get_or_init_pin(

0 commit comments

Comments
 (0)