Skip to content

Commit f8265e7

Browse files
authored
Rollup merge of rust-lang#115311 - dtolnay:usearcself, r=compiler-errors
Revert "Suggest using `Arc` on `!Send`/`!Sync` types" Closes rust-lang#114687. This is a clean revert of rust-lang#88936 + rust-lang#115210. The suggestion to Arc\<{Self}\> when Self does not implement Send is *always* wrong. rust-lang#114842 is considering a way to make a more refined suggestion.
2 parents c7f629f + 430b479 commit f8265e7

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

core/src/marker.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,8 @@ macro marker_impls {
7676
#[stable(feature = "rust1", since = "1.0.0")]
7777
#[cfg_attr(not(test), rustc_diagnostic_item = "Send")]
7878
#[rustc_on_unimplemented(
79-
on(_Self = "std::rc::Rc<T, A>", note = "use `std::sync::Arc` instead of `std::rc::Rc`"),
80-
on(_Self = "alloc::rc::Rc<T, A>", note = "use `alloc::sync::Arc` instead of `alloc::rc::Rc`"),
8179
message = "`{Self}` cannot be sent between threads safely",
82-
label = "`{Self}` cannot be sent between threads safely",
83-
note = "consider using `std::sync::Arc<{Self}>`; for more information visit \
84-
<https://doc.rust-lang.org/book/ch16-03-shared-state.html>"
80+
label = "`{Self}` cannot be sent between threads safely"
8581
)]
8682
pub unsafe auto trait Send {
8783
// empty.
@@ -632,12 +628,8 @@ impl<T: ?Sized> Copy for &T {}
632628
any(_Self = "core::cell::RefCell<T>", _Self = "std::cell::RefCell<T>"),
633629
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead",
634630
),
635-
on(_Self = "std::rc::Rc<T, A>", note = "use `std::sync::Arc` instead of `std::rc::Rc`"),
636-
on(_Self = "alloc::rc::Rc<T, A>", note = "use `alloc::sync::Arc` instead of `alloc::rc::Rc`"),
637631
message = "`{Self}` cannot be shared between threads safely",
638-
label = "`{Self}` cannot be shared between threads safely",
639-
note = "consider using `std::sync::Arc<{Self}>`; for more information visit \
640-
<https://doc.rust-lang.org/book/ch16-03-shared-state.html>"
632+
label = "`{Self}` cannot be shared between threads safely"
641633
)]
642634
pub unsafe auto trait Sync {
643635
// FIXME(estebank): once support to add notes in `rustc_on_unimplemented`

0 commit comments

Comments
 (0)