-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Error when passing a trait object as a generic type doesn't indicate what is the trait object #61525
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-traits
Area: Trait system
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
estebank
added
A-traits
Area: Trait system
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Nov 5, 2019
Is the following output from #68377 enough?
|
estebank
added
the
D-papercut
Diagnostics: An error or lint that needs small tweaks.
label
Feb 2, 2020
I don't feel like it's at the usual amazing quality 😿. My points still appear to exist:
In some magical world, I might hope for something like this (and I'm very flexible in that):
I tried to address my points via the |
bors
added a commit
that referenced
this issue
Feb 4, 2020
Tweak obligation error output - Point at arguments or output when fn obligations come from them, or ident when they don't - Point at `Sized` bound (fix #47990) - When object unsafe trait uses itself in associated item suggest using `Self` (fix #66424, fix #33375, partially address #38376, cc #61525) - Point at reason in object unsafe trait with `Self` in supertraits or `where`-clause (cc #40533, cc #68377) - On implicit type parameter `Sized` obligations, suggest `?Sized` (fix #57744, fix #46683)
crlf0710
added
the
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
label
Jun 11, 2020
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jul 11, 2022
Do not error during method probe on `Sized` predicates for types that aren't the method receiver Fixes rust-lang#61525 This is safe even though we're skipping an error because we end up confirming the method, which means we're still checking the `Sized` predicate in the end. It just means that we don't emit an erroneous message as below: ``` error: the `query` method cannot be invoked on a trait object --> src/lib.rs:14:11 | 14 | 1.query::<dyn ToString>("") | ^^^^^ | = note: another candidate was found in the following trait, perhaps add a `use` for it: `use crate::Example;` ``` Also fixes erroneously suggesting the same trait over again, as seen in the `issue-35976.rs` UI test.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jul 11, 2022
Do not error during method probe on `Sized` predicates for types that aren't the method receiver Fixes rust-lang#61525 This is safe even though we're skipping an error because we end up confirming the method, which means we're still checking the `Sized` predicate in the end. It just means that we don't emit an erroneous message as below: ``` error: the `query` method cannot be invoked on a trait object --> src/lib.rs:14:11 | 14 | 1.query::<dyn ToString>("") | ^^^^^ | = note: another candidate was found in the following trait, perhaps add a `use` for it: `use crate::Example;` ``` Also fixes erroneously suggesting the same trait over again, as seen in the `issue-35976.rs` UI test.
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-traits
Area: Trait system
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Issues with this diagnostic:
query
method is not being invoked on a trait object; it's invoked on the concrete value1
.The text was updated successfully, but these errors were encountered: