-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Wrong span for E0277 error message "trait bound is not satisfied" #98645
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Thanks for the report! I have transferred this to the rust-lang/rust repository as this is a rustc issue. |
I bisected this to nightly-2021-10-27. There are several PRs which are candidates there 29b1248...e269e6b The most likely look like either #90282, #90299, or #90075. The previous error message looked like:
|
cargo check
error message says that wrong variable doesn't satisfy trait bound
This is probably #90181 |
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Jun 29, 2022
…on, r=oli-obk Clean up arg mismatch diagnostic, generalize tuple wrap suggestion This is based on top of rust-lang#97542, so just look at the last commit which contains the relevant changes. 1. Remove `final_arg_types` which was one of the last places we were using raw (`usize`) indices instead of typed indices in the arg mismatch suggestion code. 2. Improve the tuple wrap suggestion, now we suggest things like `call(a, b, c, d)` -> `call(a, (b, c), d)` 😺 3. Folded in fix rust-lang#98645
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Problem
I had an error in my code where I tried to convert a
u32
to an enum usingtry_into
without implementing it first. My code essentially looked like this:This code generates the following error message:
The compiler correctly notes that I have not implemented
TryInto
onThing
foru32
, but it tells me that I haven't satisfied that trait bound forvalue
, notthing
. This problem does not occur if I use a struct initializer, only if I use a function.Steps
cargo check
Possible Solution(s)
My guess here is that when showing an error for trait bound in a function argument, the checker defaults to the first argument. I'm not familiar with
cargo
code though so that's just speculation.Notes
I am using the nightly compiler, but the same problem occurs on stable.
Version
The text was updated successfully, but these errors were encountered: