mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
Rollup merge of #89693 - jkugelman:must-use-stdin-stdout-stderr-locks, r=joshtriplett
Add #[must_use] to stdin/stdout/stderr locks Affected methods: ```rust std::io fn stdin_locked() -> StdinLock<'static>; std::io::Stdin fn lock(&self) -> StdinLock<'_>; std::io fn stdout_locked() -> StdoutLock<'static>; std::io::Stdout fn lock(&self) -> StdoutLock<'_>; std::io fn stderr_locked() -> StderrLock<'static>; std::io::Stderr fn lock(&self) -> StderrLock<'_>; ``` Parent issue: https://github.com/rust-lang/rust/issues/89692
This commit is contained in:
commit
ee804594c8
@ -256,6 +256,7 @@ pub struct Stdin {
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// ```
|
||||
#[must_use = "if unused stdin will immediately unlock"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct StdinLock<'a> {
|
||||
inner: MutexGuard<'a, BufReader<StdinRaw>>,
|
||||
@ -624,6 +625,7 @@ pub struct Stdout {
|
||||
/// When operating in a console, the Windows implementation of this stream does not support
|
||||
/// non-UTF-8 byte sequences. Attempting to write bytes that are not valid UTF-8 will return
|
||||
/// an error.
|
||||
#[must_use = "if unused stdout will immediately unlock"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct StdoutLock<'a> {
|
||||
inner: ReentrantMutexGuard<'a, RefCell<LineWriter<StdoutRaw>>>,
|
||||
@ -907,6 +909,7 @@ pub struct Stderr {
|
||||
/// When operating in a console, the Windows implementation of this stream does not support
|
||||
/// non-UTF-8 byte sequences. Attempting to write bytes that are not valid UTF-8 will return
|
||||
/// an error.
|
||||
#[must_use = "if unused stderr will immediately unlock"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct StderrLock<'a> {
|
||||
inner: ReentrantMutexGuard<'a, RefCell<StderrRaw>>,
|
||||
|
Loading…
Reference in New Issue
Block a user