about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorEsteban Kuber <esteban@kuber.com.ar>2021-09-14 15:44:08 +0000
committerEsteban Küber <esteban@kuber.com.ar>2023-08-09 14:04:10 +0000
commit9de1a472b68ed85f396b2e2cc79c3ef17584d6e1 (patch)
tree0e93df76a07e347476929f16ca8da0084d6c18cc /library/core/src
parent19a647d6d8f6ead984d7b431c4a8376e02c543e6 (diff)
downloadrust-9de1a472b68ed85f396b2e2cc79c3ef17584d6e1.tar.gz
rust-9de1a472b68ed85f396b2e2cc79c3ef17584d6e1.zip
Suggest using `Arc` on `!Send`/`!Sync` types
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/marker.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs
index 5ec751e5168..aec287226a0 100644
--- a/library/core/src/marker.rs
+++ b/library/core/src/marker.rs
@@ -76,8 +76,11 @@ macro marker_impls {
 #[stable(feature = "rust1", since = "1.0.0")]
 #[cfg_attr(not(test), rustc_diagnostic_item = "Send")]
 #[rustc_on_unimplemented(
+    on(_Self = "std::rc::Rc<T, A>", note = "use `std::sync::Arc` instead of `std::rc::Rc`"),
     message = "`{Self}` cannot be sent between threads safely",
-    label = "`{Self}` cannot be sent between threads safely"
+    label = "`{Self}` cannot be sent between threads safely",
+    note = "consider using `std::sync::Arc<{Self}>`; for more information visit \
+            <https://doc.rust-lang.org/book/ch16-03-shared-state.html>"
 )]
 pub unsafe auto trait Send {
     // empty.
@@ -628,8 +631,11 @@ impl<T: ?Sized> Copy for &T {}
         any(_Self = "core::cell::RefCell<T>", _Self = "std::cell::RefCell<T>"),
         note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead",
     ),
+    on(_Self = "std::rc::Rc<T, A>", note = "use `std::sync::Arc` instead of `std::rc::Rc`"),
     message = "`{Self}` cannot be shared between threads safely",
-    label = "`{Self}` cannot be shared between threads safely"
+    label = "`{Self}` cannot be shared between threads safely",
+    note = "consider using `std::sync::Arc<{Self}>`; for more information visit \
+            <https://doc.rust-lang.org/book/ch16-03-shared-state.html>"
 )]
 pub unsafe auto trait Sync {
     // FIXME(estebank): once support to add notes in `rustc_on_unimplemented`