Repository navigation
Do not retain Normalization goal errors in nested goals for BestObligationVisitor:: non_trivial_candidates
#162443
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
Merged
rust-bors
merged 1 commit into
rust-lang:main
from
LorrensP-2158466:fix-best-obligation-visitor
Oct 9, 2026
+97
−10
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
tests/ui/traits/next-solver/confusing-diagnostic-due-to-best-obligation-visitor.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| //@compile-flags: -Znext-solver=globally | ||
| //@check-fail | ||
|
|
||
| // See issue https://github.com/rust-lang/rust/issues/161882, test makes sure we don't report | ||
| // irrelevant and not implemented bounds when we can't proof an obligation. | ||
|
|
||
| struct MyError; | ||
|
|
||
| trait MaybeFallible { | ||
| type Error: MaybeError; //~ ERROR: the trait bound `MyError: From<<Self as MaybeFallible>::Error>` is not satisfied | ||
| } | ||
|
|
||
| trait MaybeError: Sized | ||
| where | ||
| MyError: From<Self>, | ||
| { | ||
| type ComposeWithOther: MaybeError; //~ ERROR: the trait bound `MyError: From<<Self as MaybeError>::ComposeWithOther>` is not satisfied | ||
| } | ||
|
|
||
| fn compose<A: MaybeFallible, B>() -> Result<(), ()> | ||
| where | ||
| <A::Error as MaybeError>::ComposeWithOther: From<B>, //~ ERROR: the trait bound `MyError: From<<A as MaybeFallible>::Error>` is not satisfied | ||
| { | ||
| todo!() | ||
| } | ||
|
|
||
| fn main() {} |
64 changes: 64 additions & 0 deletions
64
tests/ui/traits/next-solver/confusing-diagnostic-due-to-best-obligation-visitor.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| error[E0277]: the trait bound `MyError: From<<A as MaybeFallible>::Error>` is not satisfied | ||
| --> $DIR/confusing-diagnostic-due-to-best-obligation-visitor.rs:22:49 | ||
| | | ||
| LL | <A::Error as MaybeError>::ComposeWithOther: From<B>, | ||
| | ^^^^^^^ unsatisfied trait bound | ||
| | | ||
| help: the trait `From<<A as MaybeFallible>::Error>` is not implemented for `MyError` | ||
| --> $DIR/confusing-diagnostic-due-to-best-obligation-visitor.rs:7:1 | ||
| | | ||
| LL | struct MyError; | ||
| | ^^^^^^^^^^^^^^ | ||
| note: required by a bound in `MaybeError` | ||
| --> $DIR/confusing-diagnostic-due-to-best-obligation-visitor.rs:15:14 | ||
| | | ||
| LL | trait MaybeError: Sized | ||
| LL | where | ||
| LL | MyError: From<Self>, | ||
| | ^^^^^^^^^^ required by this bound in `MaybeError` | ||
| help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | ||
| | | ||
| LL | <A::Error as MaybeError>::ComposeWithOther: From<B>, MyError: From<<A as MaybeFallible>::Error> | ||
| | ++++++++++++++++++++++++++++++++++++++++++ | ||
|
|
||
| error[E0277]: the trait bound `MyError: From<<Self as MaybeFallible>::Error>` is not satisfied | ||
| --> $DIR/confusing-diagnostic-due-to-best-obligation-visitor.rs:10:17 | ||
| | | ||
| LL | type Error: MaybeError; | ||
| | ^^^^^^^^^^ unsatisfied trait bound | ||
| | | ||
| help: the trait `From<<Self as MaybeFallible>::Error>` is not implemented for `MyError` | ||
| --> $DIR/confusing-diagnostic-due-to-best-obligation-visitor.rs:7:1 | ||
| | | ||
| LL | struct MyError; | ||
| | ^^^^^^^^^^^^^^ | ||
| note: required by a bound in `MaybeError` | ||
| --> $DIR/confusing-diagnostic-due-to-best-obligation-visitor.rs:15:14 | ||
| | | ||
| LL | trait MaybeError: Sized | ||
| LL | where | ||
| LL | MyError: From<Self>, | ||
| | ^^^^^^^^^^ required by this bound in `MaybeError` | ||
|
|
||
| error[E0277]: the trait bound `MyError: From<<Self as MaybeError>::ComposeWithOther>` is not satisfied | ||
| --> $DIR/confusing-diagnostic-due-to-best-obligation-visitor.rs:17:28 | ||
| | | ||
| LL | type ComposeWithOther: MaybeError; | ||
| | ^^^^^^^^^^ unsatisfied trait bound | ||
| | | ||
| help: the trait `From<<Self as MaybeError>::ComposeWithOther>` is not implemented for `MyError` | ||
| --> $DIR/confusing-diagnostic-due-to-best-obligation-visitor.rs:7:1 | ||
| | | ||
| LL | struct MyError; | ||
| | ^^^^^^^^^^^^^^ | ||
| note: required by a bound in `MaybeError` | ||
| --> $DIR/confusing-diagnostic-due-to-best-obligation-visitor.rs:15:14 | ||
| | | ||
| LL | trait MaybeError: Sized | ||
| LL | where | ||
| LL | MyError: From<Self>, | ||
| | ^^^^^^^^^^ required by this bound in `MaybeError` | ||
|
|
||
| error: aborting due to 3 previous errors | ||
|
|
||
| For more information about this error, try `rustc --explain E0277`. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.