fix E0371 description#156752
Open
42triangles wants to merge 1 commit into
Open
Conversation
Collaborator
|
r? @oli-obk rustbot has assigned @oli-obk. Use Why was this reviewer chosen?The reviewer was selected based on:
|
oli-obk
reviewed
May 20, 2026
| impl Bar for dyn Baz { } // error, `Baz` implements `Bar` by definition | ||
| impl Foo for dyn Baz { } // error, `Baz` implements `Bar` which implements `Foo` | ||
| impl Baz for dyn Baz { } // error, `Baz` (trivially) implements `Baz` | ||
| impl Baz for dyn Bar { } // Note: This is OK |
Contributor
There was a problem hiding this comment.
If you pull this last one out into a separate block that is not compile_error, we make sure it actually doesn't error.
You can render it nicely by putting # in front of the duplicated definition lines (you'll need to duplicate the trait defs into the new block)
Author
There was a problem hiding this comment.
(Mostly for future reference,) that should catch the (in this case only warnings IIRC) that were emitted as well in the success case I assume?
11bd32a to
173bad7
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This changes the
impls to beimpl {Trait} for dyn {Trait}instead of justimpl {Trait} for {Trait}in the description of E0371.(While this was not part of "Crafting errors like rustc" workshop at RustWeek by @jdonszelmann and @estebank, I found this while going through all errors Rust emits to pick a favourite)