Skip to content

Commit 835dce5

Browse files
committed
Auto merge of rust-lang#86744 - ijackson:sink-default, r=dtolnay
impl Default, Copy, Clone for std::io::Sink and Empty The omission of `Sink: Default` is causing me a slight inconvenience in a test harness. There seems little reason for this and `Empty` not to be `Clone` and `Copy` too. I have made all three of these insta-stable, because: AIUI `Copy` can only be derived, and I was not able to find any examples of how to unstably derive it. I think it is probably not possible. I hunted through the git history for precedent and found > 79b8ad8 > Implement `Copy` for `IoSlice` > rust-lang#69403 which was also insta-stable.
2 parents 798446f + a7e88e0 commit 835dce5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/std/src/io/util.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::io::{
1414
/// the documentation of [`empty()`] for more details.
1515
#[stable(feature = "rust1", since = "1.0.0")]
1616
#[non_exhaustive]
17+
#[derive(Copy, Clone, Default)]
1718
pub struct Empty;
1819

1920
/// Constructs a new handle to an empty reader.
@@ -172,6 +173,7 @@ impl fmt::Debug for Repeat {
172173
/// see the documentation of [`sink()`] for more details.
173174
#[stable(feature = "rust1", since = "1.0.0")]
174175
#[non_exhaustive]
176+
#[derive(Copy, Clone, Default)]
175177
pub struct Sink;
176178

177179
/// Creates an instance of a writer which will successfully consume all data.

0 commit comments

Comments
 (0)