-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
(rust-highfive has picked a reviewer for you, use r? to override) |
Oh, the instance is actually needed somehow. But how...?!? |
Ah no, that's just a harmless error message change. |
also move them next to the trait they are implementing
Was this ever needed (and the compiler just got smarter), or was this always redundant? |
I don't think the mutable reference instance was ever needed (given that I can find no trace of similar instances for |
r? @thomcc |
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... |
Having them for I'm happy to add back the one for |
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 rollup |
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? |
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 |
Yeah, I have no clue if it matters for perf. I usually just leave it as maybe if that's the case. |
…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
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 forSync
, so IMO we should be consistent and not have the redundant instance here, either.