-
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
More helpful output for slightly-wrong dyn with multiple traits. #84772
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-parser
Area: The parsing of Rust source code to an AST
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
jonhoo
added
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
May 1, 2021
estebank
added
A-parser
Area: The parsing of Rust source code to an AST
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
labels
May 1, 2021
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
May 5, 2021
Handle incorrect placement of parentheses in trait bounds more gracefully Fix rust-lang#84772. CC `@jonhoo`
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
May 5, 2021
Handle incorrect placement of parentheses in trait bounds more gracefully Fix rust-lang#84772. CC ``@jonhoo``
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
May 6, 2021
Handle incorrect placement of parentheses in trait bounds more gracefully Fix rust-lang#84772. CC ```@jonhoo```
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
May 6, 2021
Handle incorrect placement of parentheses in trait bounds more gracefully Fix rust-lang#84772. CC ````@jonhoo````
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
May 6, 2021
Handle incorrect placement of parentheses in trait bounds more gracefully Fix rust-lang#84772. CC `````@jonhoo`````
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
May 6, 2021
Handle incorrect placement of parentheses in trait bounds more gracefully Fix rust-lang#84772. CC ``````@jonhoo``````
Reopening and keeping around for a single unhandled case left: |
estebank
added
P-low
Low priority
and removed
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
labels
May 7, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-parser
Area: The parsing of Rust source code to an AST
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I recently tried to demonstrate why
dyn Trait1 + Trait2
doesn't work. I ended up writing (all examples below on playground):and because I was in my editor, I only saw the first part of the error: "ambiguous
+
in a type". As a result, rather than follow the helpful compiler errorI went ahead and tried to fix the syntax myself. Unfortunately, those only gave me worse error messages. I tried:
which gives
I tried:
Which gives
This one is particularly egregious as it suggests there's a missing
,
.I tried:
Which gives
I tried:
Which gives
This one is even more problematic as it not only suggests there's a missing
,
, but also suggests thatdyn Drop
is the problem.Ideally, all of these cases should point out that I probably meant
&(dyn Drop + AsRef<str>)
, and also give the friendly "only auto traits can be used as additional traits in a trait object" message.The error messages are (currently) all the same on nightly.
See also discussion on Twitter.
The text was updated successfully, but these errors were encountered: