-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Avoid describing a method as 'not found' when bounds are unsatisfied #81149
Avoid describing a method as 'not found' when bounds are unsatisfied #81149
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This makes the primary error message multi-line. I'm open to any suggestions for a better way of showing this information. |
r? @estebank |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of the proposed output?
error[E0599]: the method `f` exists for type `u32`, but the following trait bounds were not satisfied: | ||
`<u32 as X<'b>>::U: Clone` | ||
which is required by `u32: X` | ||
--> $DIR/hr-associated-type-bound-2.rs:19:10 | ||
| | ||
LL | 1u32.f("abc"); | ||
| ^ method not found in `u32` | ||
| | ||
= note: the method `f` exists but the following trait bounds were not satisfied: | ||
`<u32 as X<'b>>::U: Clone` | ||
which is required by `u32: X` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think if we instead output:
error[E0599]: the method `f` exists for type `u32`, but its trait bounds were not satisfied
--> $DIR/hr-associated-type-bound-2.rs:19:10
|
LL | 1u32.f("abc");
| ^ method not found in `u32` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`<u32 as X<'b>>::U: Clone`
which is required by `u32: X`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good, except for the usage of 'not found' in "method not found in u32
due to unsatisfied trait bounds". I think it should say something like "method cannot be called on u32
due to unsatisfied trait bounds".
The job Click to see the possible cause of the failure (guessed by this bot)
|
fe85c83
to
bb4f70c
Compare
@estebank I've updated the error message. |
@bors r+ |
📌 Commit bb4f70c has been approved by |
…found-err, r=estebank Avoid describing a method as 'not found' when bounds are unsatisfied Fixes rust-lang#76267 When there is a single applicable method candidate, but its trait bounds are not satisfied, we avoid saying that the method is "not found". Insted, we update the error message to directly mention which bounds are not satisfied, rather than mentioning them in a note.
Fixes rust-lang#76267 When there is a single applicable method candidate, but its trait bounds are not satisfied, we avoid saying that the method is "not found". Insted, we update the error message to directly mention which bounds are not satisfied, rather than mentioning them in a note.
bb4f70c
to
dea8a16
Compare
@bors r=estebank |
📌 Commit dea8a16 has been approved by |
@bors r- failed in #81449 (comment) |
@bors rollup=never |
Failed due to #81351 adding a new error to a test. I'll rebase this PR once that PR lands in the current rollup. |
📌 Commit dea8a16 has been approved by |
⌛ Testing commit dea8a16 with merge e46baecedb47431e475b87aadf0bc1ffed28a0c5... |
💥 Test timed out |
@bors retry |
☀️ Test successful - checks-actions |
Fixes #76267
When there is a single applicable method candidate, but its trait bounds
are not satisfied, we avoid saying that the method is "not found".
Insted, we update the error message to directly mention which bounds are
not satisfied, rather than mentioning them in a note.