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

Add comments regarding superfluous !Sync impls #87530

Merged
merged 1 commit into from
Nov 9, 2021

Conversation

bstrie
Copy link
Contributor

@bstrie bstrie commented Jul 27, 2021

No description provided.

@rust-highfive
Copy link
Collaborator

r? @yaahc

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 27, 2021
@yaahc
Copy link
Member

yaahc commented Jul 28, 2021

I know you mentioned this in Discord but just to reiterate here, we should check what error messages we produce with and without the explicit !Send/!Sync impls and either remove the maybe or remove the entire parenthesized section at the end of the new comments before merging.

Once you've done the clarification please feel free to approve on my behalf.

@yaahc
Copy link
Member

yaahc commented Jul 28, 2021

@bors delegate+

@bors
Copy link
Contributor

bors commented Jul 28, 2021

✌️ @bstrie can now approve this pull request

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 15, 2021
@wesleywiser wesleywiser 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 20, 2021
@JohnCSimon
Copy link
Member

Ping from triage:
@bstrie - fyi this was changed to S-waiting-on-author.

@the8472 the8472 added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 8, 2021
@JohnCSimon JohnCSimon 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 27, 2021
@JohnCSimon JohnCSimon 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 19, 2021
@JohnCSimon
Copy link
Member

Ping from triage:
@bstrie - can you please post your status on this PR? Thanks

@bstrie
Copy link
Contributor Author

bstrie commented Nov 8, 2021

we should check what error messages we produce with and without the explicit !Send/!Sync impls and either remove the maybe or remove the entire parenthesized section at the end of the new comments before merging.

Rather than rebuilding all of std just to test the error messages, I found it faster to copy the definition of Rc into its own file, since presumably the error messages will be the same. Here's the error with the explicit !Sync:

error[E0277]: `Rc<()>` cannot be shared between threads safely
  --> src/main.rs:24:19
   |
24 |     requires_sync(rc);
   |     ------------- ^^ `Rc<()>` cannot be shared between threads safely
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `Sync` is not implemented for `Rc<()>`
note: required by a bound in `requires_sync`
  --> src/main.rs:27:21
   |
27 | fn requires_sync<T: Sync>(t: T) {
   |                     ^^^^ required by this bound in `requires_sync`

and the error without it:

error[E0277]: `NonNull<RcBox<()>>` cannot be shared between threads safely
  --> src/main.rs:22:19
   |
22 |     requires_sync(rc);
   |     ------------- ^^ `NonNull<RcBox<()>>` cannot be shared between threads safely
   |     |
   |     required by a bound introduced by this call
   |
   = help: within `Rc<()>`, the trait `Sync` is not implemented for `NonNull<RcBox<()>>`
note: required because it appears within the type `Rc<()>`
  --> src/main.rs:15:12
   |
15 | pub struct Rc<T: ?Sized> {
   |            ^^
note: required by a bound in `requires_sync`
  --> src/main.rs:25:21
   |
25 | fn requires_sync<T: Sync>(t: T) {
   |                     ^^^^ required by this bound in `requires_sync`

error[E0277]: `Cell<usize>` cannot be shared between threads safely
  --> src/main.rs:22:19
   |
22 |     requires_sync(rc);
   |     ------------- ^^ `Cell<usize>` cannot be shared between threads safely
   |     |
   |     required by a bound introduced by this call
   |
   = help: within `Rc<()>`, the trait `Sync` is not implemented for `Cell<usize>`
note: required because it appears within the type `RcBox<()>`
  --> src/main.rs:9:8
   |
9  | struct RcBox<T: ?Sized> {
   |        ^^^^^
   = note: required because it appears within the type `PhantomData<RcBox<()>>`
note: required because it appears within the type `Rc<()>`
  --> src/main.rs:15:12
   |
15 | pub struct Rc<T: ?Sized> {
   |            ^^
note: required by a bound in `requires_sync`
  --> src/main.rs:25:21
   |
25 | fn requires_sync<T: Sync>(t: T) {
   |                     ^^^^ required by this bound in `requires_sync`

So yes, this indicates that removing this impl would be a diagnostic regression.

@bstrie
Copy link
Contributor Author

bstrie commented Nov 8, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Nov 8, 2021

📌 Commit 86c0ef8 has been approved by bstrie

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 8, 2021
@bstrie
Copy link
Contributor Author

bstrie commented Nov 8, 2021

@bors r+ rollup=always

@bors
Copy link
Contributor

bors commented Nov 8, 2021

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Nov 8, 2021

📌 Commit 86c0ef8 has been approved by bstrie

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 8, 2021
Add comments regarding superfluous `!Sync` impls
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 8, 2021
Add comments regarding superfluous `!Sync` impls
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 8, 2021
Add comments regarding superfluous `!Sync` impls
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 9, 2021
Rollup of 6 pull requests

Successful merges:

 - rust-lang#87530 (Add comments regarding superfluous `!Sync` impls)
 - rust-lang#90591 (treat illumos like solaris in failing ui tests which need it)
 - rust-lang#90678 (Add some GATs-related regression tests)
 - rust-lang#90688 (enable `dotprod` target feature in arm)
 - rust-lang#90708 (Add a note about feature(explicit_generic_args_with_impl_trait) to the relevant error message)
 - rust-lang#90720 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d638c1d into rust-lang:master Nov 9, 2021
@rustbot rustbot added this to the 1.58.0 milestone Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

8 participants