diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-06-16 19:39:39 +0400 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-06-16 19:54:42 +0400 |
| commit | c1a2db3372a4d6896744919284f3287650a38ab7 (patch) | |
| tree | 636b2ff560a6dc628c5cec1440db82210b73dee5 /library/std/src/io/stdio.rs | |
| parent | 7c360dc117d554a11f7193505da0835c4b890c6f (diff) | |
| download | rust-c1a2db3372a4d6896744919284f3287650a38ab7.tar.gz rust-c1a2db3372a4d6896744919284f3287650a38ab7.zip | |
Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`
Diffstat (limited to 'library/std/src/io/stdio.rs')
| -rw-r--r-- | library/std/src/io/stdio.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index ae16015e35a..e3b62894d0f 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -8,10 +8,9 @@ use crate::io::prelude::*; use crate::cell::{Cell, RefCell}; use crate::fmt; use crate::io::{self, BufReader, IoSlice, IoSliceMut, LineWriter, Lines}; -use crate::lazy::SyncOnceCell; use crate::pin::Pin; use crate::sync::atomic::{AtomicBool, Ordering}; -use crate::sync::{Arc, Mutex, MutexGuard}; +use crate::sync::{Arc, Mutex, MutexGuard, OnceLock}; use crate::sys::stdio; use crate::sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; @@ -318,7 +317,7 @@ pub struct StdinLock<'a> { #[must_use] #[stable(feature = "rust1", since = "1.0.0")] pub fn stdin() -> Stdin { - static INSTANCE: SyncOnceCell<Mutex<BufReader<StdinRaw>>> = SyncOnceCell::new(); + static INSTANCE: OnceLock<Mutex<BufReader<StdinRaw>>> = OnceLock::new(); Stdin { inner: INSTANCE.get_or_init(|| { Mutex::new(BufReader::with_capacity(stdio::STDIN_BUF_SIZE, stdin_raw())) @@ -552,7 +551,7 @@ pub struct StdoutLock<'a> { inner: ReentrantMutexGuard<'a, RefCell<LineWriter<StdoutRaw>>>, } -static STDOUT: SyncOnceCell<ReentrantMutex<RefCell<LineWriter<StdoutRaw>>>> = SyncOnceCell::new(); +static STDOUT: OnceLock<ReentrantMutex<RefCell<LineWriter<StdoutRaw>>>> = OnceLock::new(); /// Constructs a new handle to the standard output of the current process. /// @@ -837,7 +836,7 @@ pub fn stderr() -> Stderr { // Note that unlike `stdout()` we don't use `at_exit` here to register a // destructor. Stderr is not buffered , so there's no need to run a // destructor for flushing the buffer - static INSTANCE: SyncOnceCell<ReentrantMutex<RefCell<StderrRaw>>> = SyncOnceCell::new(); + static INSTANCE: OnceLock<ReentrantMutex<RefCell<StderrRaw>>> = OnceLock::new(); Stderr { inner: Pin::static_ref(&INSTANCE).get_or_init_pin( |
