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

Refine error message for thread-safe usage of std::sync::Arc<{Self}> #114842

Closed
wants to merge 2 commits into from

Conversation

reez12g
Copy link
Contributor

@reez12g reez12g commented Aug 15, 2023

fixes #114687

@rustbot
Copy link
Collaborator

rustbot commented Aug 15, 2023

r? @thomcc

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 15, 2023
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@m-ou-se
Copy link
Member

m-ou-se commented Aug 23, 2023

This still points people at Arc as a solution for situations where Arc is useless. Arc doesn't make a !Send things Send, for example. I think the message should just be removed.

@estebank
Copy link
Contributor

We can leave only the link to the book and not mention Arc at all in the !Send case.

@thomcc
Copy link
Member

thomcc commented Aug 28, 2023

I don't have strong feelings here, so perhaps @m-ou-se should take this review, since she seems to care more than I.

r? @m-ou-se

@rustbot rustbot assigned m-ou-se and unassigned thomcc Aug 28, 2023
@@ -79,7 +79,7 @@ macro marker_impls {
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",
note = "consider using `std::sync::Arc<{Self}>`; for more information visit \
note = "consider whether `std::sync::Arc<{Self}>` could be incorporated to share this value between threads; for more information visit \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as Arc<{Self}> continues to be mentioned, this does not fix #114687. That suggestion is always wrong.

@dtolnay dtolnay added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 28, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 28, 2023
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.
@bors
Copy link
Contributor

bors commented Aug 28, 2023

☔ The latest upstream changes (presumably #115326) made this pull request unmergeable. Please resolve the merge conflicts.

@reez12g
Copy link
Contributor Author

reez12g commented Aug 29, 2023

Thank you for your reviews.
Since issue #114687 is now closed, I am going to close this Pull Request as well.

@reez12g reez12g closed this Aug 29, 2023
@dtolnay dtolnay self-assigned this Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion to use Arc<T> is too indiscriminate
8 participants