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

remove redundant Send impl for references #103110

Merged
merged 1 commit into from
Oct 28, 2022
Merged

Conversation

RalfJung
Copy link
Member

Also explain why the other instance is not redundant, move it next to the trait they are implementing, and out of the redundant module. This seems to go back all the way to 35ca50b, not sure why the module was added.

The instance for &mut is the default instance we get anyway, and we don't have anything similar for Sync, so IMO we should be consistent and not have the redundant instance here, either.

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Oct 16, 2022
@rustbot
Copy link
Collaborator

rustbot commented Oct 16, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(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 Oct 16, 2022
@RalfJung
Copy link
Member Author

Oh, the instance is actually needed somehow. But how...?!?

@RalfJung
Copy link
Member Author

RalfJung commented Oct 16, 2022

Ah no, that's just a harmless error message change.

also move them next to the trait they are implementing
@joshtriplett
Copy link
Member

Was this ever needed (and the compiler just got smarter), or was this always redundant?

@RalfJung
Copy link
Member Author

RalfJung commented Oct 16, 2022

I don't think the mutable reference instance was ever needed (given that I can find no trace of similar instances for Sync), but I can't really speak for Rust before 1.0 so who knows.

@RalfJung RalfJung changed the title remove redundant Send impls for references remove redundant Send impl for references Oct 16, 2022
@RalfJung
Copy link
Member Author

r? @thomcc

@rust-highfive rust-highfive assigned thomcc and unassigned joshtriplett Oct 26, 2022
@thomcc
Copy link
Member

thomcc commented Oct 27, 2022

Hmm, these are kind of nice to have for documentation reasons, if I'm being honest. I know once upon a time having these explicit impls helped me understand how Send/Sync interacted with references. Perhaps that's a failing of our documentation elsewhere, though...

@RalfJung
Copy link
Member Author

Having them for Send but not Sync seems more confusing than helpful for me.

I'm happy to add back the one for Send and then also the ones for Sync, and explicitly say they are redundant and documentation-only, if you prefer that.

@thomcc
Copy link
Member

thomcc commented Oct 27, 2022

Hm, that's a pretty good point, I think I'm sold. Doing something like that for documentation should probably be in the actual documentation, rather than in the code.

@bors r+

@bors
Copy link
Contributor

bors commented Oct 27, 2022

📌 Commit 73d655e has been approved by thomcc

It is now in the queue for this repository.

@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-review Status: Awaiting review from the assignee but also interested parties. labels Oct 27, 2022
@RalfJung
Copy link
Member Author

@bors rollup

@thomcc
Copy link
Member

thomcc commented Oct 27, 2022

This changes code on a blanket impl for all references on a widely used trait. Even if semantically there is no change, I genuinely have no idea how that might impact compiler performance, are you sure rollup=always is appropriate?

@RalfJung
Copy link
Member Author

I didn't think there is any chance of a perf regression here. Also note this has been rolled up before I even added that flag. If you think a PR has a chance of perf regression you need to do bors rollup=iffy or, better, just trigger a timing build.

@thomcc
Copy link
Member

thomcc commented Oct 27, 2022

Yeah, I have no clue if it matters for perf. I usually just leave it as maybe if that's the case.

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 27, 2022
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#103110 (remove redundant Send impl for references)
 - rust-lang#103255 (Clean up hidden type registration)
 - rust-lang#103394 (Clarify documentation about the memory layout of `UnsafeCell`)
 - rust-lang#103408 (Clean return-position `impl Trait` in traits correctly in rustdoc)
 - rust-lang#103505 (rustdoc: parse self-closing tags and attributes in `invalid_html_tags`)
 - rust-lang#103524 (rustc_metadata: Add struct and variant constructors to module children at encoding time)
 - rust-lang#103544 (Add flag to forbid recovery in the parser)
 - rust-lang#103616 (rustdoc: remove CSS workaround for Firefox 29)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6d43dfb into rust-lang:master Oct 28, 2022
@rustbot rustbot added this to the 1.66.0 milestone Oct 28, 2022
@RalfJung RalfJung deleted the manual-send branch October 28, 2022 09:12
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.

6 participants