-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Harmonize using root or leaf obligation in trait error reporting #126142
Conversation
This comment has been minimized.
This comment has been minimized.
r=me with tests blessed |
d2fa92b
to
c90b1fc
Compare
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `i32: Baz<Self>` is not satisfied | |||
--> $DIR/assume-gat-normalization-for-nested-goals.rs:9:30 | |||
| | |||
LL | type Bar<T>: Baz<Self> = i32; | |||
| ^^^ the trait `Eq<i32>` is not implemented for `i32`, which is required by `i32: Baz<Self>` | |||
| ^^^ the trait `Eq<i32>` is not implemented for `<Self as Foo>::Bar<()>`, which is required by `i32: Baz<Self>` |
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.
The only appreciable difference here is that we actually report the right self type here now.
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `i32: Baz<Self>` is not satisfied | |||
--> $DIR/assume-gat-normalization-for-nested-goals.rs:9:30 | |||
| | |||
LL | type Bar<T>: Baz<Self> = i32; | |||
| ^^^ the trait `Eq<i32>` is not implemented for `i32`, which is required by `i32: Baz<Self>` |
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.
This message was also previously just not correct -- Eq<i32>
is implemented by i32
lol
@bors r=jackh726 |
…=jackh726 Harmonize using root or leaf obligation in trait error reporting When rust-lang#121826 changed the error reporting to use root obligation and not the leafmost obligation, it didn't actually make sure that all the other diagnostics helper functions used the right obligation. Specifically, when reporting similar impl candidates we are looking for impls of the root obligation, but trying to match them against the trait ref of the leaf obligation. This does a few other miscellaneous changes. There's a lot more clean-up that could be done here, but working with this code is really grief-inducing due to how messy it has become over the years. Someone really needs to show it love. 😓 r? `@estebank` Fixes rust-lang#126129
sorry, seems to need a rebase! |
"conflicts" with https://github.com/rust-lang/rust/pull/126187/files#diff-63c8c70fb480c0c10ffa9ba981d76373b6d6b48327cdd7c317b0d75148904dc6 which adds a use of @bors r- |
This comment has been minimized.
This comment has been minimized.
c90b1fc
to
ae24ebe
Compare
@bors r=jackh726 |
…=jackh726 Harmonize using root or leaf obligation in trait error reporting When rust-lang#121826 changed the error reporting to use root obligation and not the leafmost obligation, it didn't actually make sure that all the other diagnostics helper functions used the right obligation. Specifically, when reporting similar impl candidates we are looking for impls of the root obligation, but trying to match them against the trait ref of the leaf obligation. This does a few other miscellaneous changes. There's a lot more clean-up that could be done here, but working with this code is really grief-inducing due to how messy it has become over the years. Someone really needs to show it love. 😓 r? `@estebank` Fixes rust-lang#126129
…kingjubilee Rollup of 11 pull requests Successful merges: - rust-lang#125165 (Migrate `run-make/pgo-branch-weights` to `rmake`) - rust-lang#125674 (Rewrite `symlinked-extern`, `symlinked-rlib` and `symlinked-libraries` `run-make` tests in `rmake.rs` format) - rust-lang#125688 (Walk into alias-eq nested goals even if normalization fails) - rust-lang#126142 (Harmonize using root or leaf obligation in trait error reporting) - rust-lang#126303 (Urls to docs in rust_hir) - rust-lang#126328 (Add Option::is_none_or) - rust-lang#126337 (Add test for walking order dependent opaque type behaviour) - rust-lang#126351 (std::unix::fs::link using direct linkat call for Solaris.) - rust-lang#126353 (Move `MatchAgainstFreshVars` to old solver) - rust-lang#126356 (docs(rustc): Improve discoverable of Cargo docs) - rust-lang#126362 (Make `try_from_target_usize` method public) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 10 pull requests Successful merges: - rust-lang#125674 (Rewrite `symlinked-extern`, `symlinked-rlib` and `symlinked-libraries` `run-make` tests in `rmake.rs` format) - rust-lang#125688 (Walk into alias-eq nested goals even if normalization fails) - rust-lang#126142 (Harmonize using root or leaf obligation in trait error reporting) - rust-lang#126303 (Urls to docs in rust_hir) - rust-lang#126328 (Add Option::is_none_or) - rust-lang#126337 (Add test for walking order dependent opaque type behaviour) - rust-lang#126353 (Move `MatchAgainstFreshVars` to old solver) - rust-lang#126356 (docs(rustc): Improve discoverable of Cargo docs) - rust-lang#126358 (safe transmute: support `Single` enums) - rust-lang#126362 (Make `try_from_target_usize` method public) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#126142 - compiler-errors:trait-ref-split, r=jackh726 Harmonize using root or leaf obligation in trait error reporting When rust-lang#121826 changed the error reporting to use root obligation and not the leafmost obligation, it didn't actually make sure that all the other diagnostics helper functions used the right obligation. Specifically, when reporting similar impl candidates we are looking for impls of the root obligation, but trying to match them against the trait ref of the leaf obligation. This does a few other miscellaneous changes. There's a lot more clean-up that could be done here, but working with this code is really grief-inducing due to how messy it has become over the years. Someone really needs to show it love. 😓 r? ``@estebank`` Fixes rust-lang#126129
When #121826 changed the error reporting to use root obligation and not the leafmost obligation, it didn't actually make sure that all the other diagnostics helper functions used the right obligation.
Specifically, when reporting similar impl candidates we are looking for impls of the root obligation, but trying to match them against the trait ref of the leaf obligation.
This does a few other miscellaneous changes. There's a lot more clean-up that could be done here, but working with this code is really grief-inducing due to how messy it has become over the years. Someone really needs to show it love. 😓
r? @estebank
Fixes #126129