-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Use impl
's generics when suggesting fix on bad impl Copy
#99741
Use impl
's generics when suggesting fix on bad impl Copy
#99741
Conversation
r? @fee1-dead (rust-highfive has picked a reviewer for you, use r? to override) |
eb74e15
to
1390220
Compare
note: the `Copy` impl for `OnlyCopyIfDisplay<S>` requires that `S: std::fmt::Display` | ||
--> $DIR/missing-bound-in-manual-copy-impl-2.rs:4:19 | ||
| | ||
LL | struct Wrapper<T>(T); | ||
| ^ |
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.
Sorry for the late review. This span could be better but we can leave it as followup.
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.
Thanks. You're right, this is super misleading. I'll fix it.
@bors r+ |
Rollup of 5 pull requests Successful merges: - rust-lang#99186 (Use LocalDefId for closures more) - rust-lang#99741 (Use `impl`'s generics when suggesting fix on bad `impl Copy`) - rust-lang#99844 (Introduce an ArchiveBuilderBuilder) - rust-lang#99921 (triagebot.yml: CC Enselic when rustdoc-json-types changes) - rust-lang#99974 (Suggest removing a semicolon and boxing the expressions for if-else) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
See the UI test for a more complicated example, but we weren't correctly suggesting to add bounds given a manual
impl
whose generics didn't match the struct generics.Coincidentally this fix didn't cause any regressions for
derive(Copy)
impls, I think because those use the same spans in the impl generics as the struct generics, so the machinery still applies the same change.