-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Suggest using Arc
on !Send
/!Sync
types
#88936
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, what's the effect of this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's the primary span text. |
||
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` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why isn't this commented? seems like something that could use a justification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a comment.