Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Drop impl of mpsc Receiver and (Sync)Sender #114965

Merged
merged 1 commit into from
Sep 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove Drop impl of mpsc Receiver and (Sync)Sender
benschulz committed Aug 18, 2023
commit a38ea96825ae9ea66812445c9a953aeb95403702
15 changes: 0 additions & 15 deletions library/std/src/sync/mpsc/mod.rs
Original file line number Diff line number Diff line change
@@ -626,11 +626,6 @@ impl<T> Clone for Sender<T> {
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for Sender<T> {
fn drop(&mut self) {}
}

#[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for Sender<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -755,11 +750,6 @@ impl<T> Clone for SyncSender<T> {
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for SyncSender<T> {
fn drop(&mut self) {}
}

#[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for SyncSender<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -1096,11 +1086,6 @@ impl<T> IntoIterator for Receiver<T> {
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for Receiver<T> {
fn drop(&mut self) {}
}

#[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for Receiver<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2 changes: 1 addition & 1 deletion tests/ui/span/send-is-not-static-std-sync.rs
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ fn channel() {
tx.send(&z).unwrap();
}
//~^^ ERROR `z` does not live long enough
// (channels lack #[may_dangle], thus their dtors are implicit uses of `z`)
tx.use_ref(); // (channel drop glue does not use `z` => needs explicit use)
}

fn main() {}
8 changes: 3 additions & 5 deletions tests/ui/span/send-is-not-static-std-sync.stderr
Original file line number Diff line number Diff line change
@@ -75,11 +75,9 @@ LL | tx.send(&z).unwrap();
| ^^ borrowed value does not live long enough
LL | }
| - `z` dropped here while still borrowed
...
LL | }
| - borrow might be used here, when `tx` is dropped and runs the `Drop` code for type `Sender`
|
= note: values in a scope are dropped in the opposite order they are defined
LL |
LL | tx.use_ref(); // (channel drop glue does not use `z` => needs explicit use)
| -- borrow later used here

error: aborting due to 6 previous errors