Uh oh!
There was an error while loading. Please reload this page.
Add better error message when == operator is badly used - #41559
Conversation
rust-highfive
commented
Apr 26, 2017
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
estebank
commented
Apr 26, 2017
@GuillaumeGomez you need to update the output of |
GuillaumeGomez
commented
Apr 26, 2017
Ah thanks! |
416e528 to
be84188CompareGuillaumeGomez
commented
Apr 26, 2017
The output looks way nicer this way. :D (Updated.) |
There was a problem hiding this comment.
This is just let trait_display = trait_ref.to_string();
be84188 to
3f02379CompareGuillaumeGomez
commented
May 1, 2017
Updated. |
kennytm
commented
May 1, 2017
I thought a better error message should suggest |
GuillaumeGomez
commented
May 1, 2017
Well, I didn't add the where clause, it was already there. |
kennytm
commented
May 1, 2017
@GuillaumeGomez Ah I see. |
There was a problem hiding this comment.
This will not work with no_std (as pointed out before to me).
There was a problem hiding this comment.
The label and a note have the same text.
There was a problem hiding this comment.
Ah, didn't look more below. :-/
3f02379 to
a908964CompareGuillaumeGomez
commented
May 2, 2017
Updated. |
Mark-Simulacrum
commented
May 7, 2017
Label and note seem to have the same text still? @GuillaumeGomez Was that intentional? |
GuillaumeGomez
commented
May 7, 2017
No, I need to fix this. |
a908964 to
88082daCompareGuillaumeGomez
commented
May 7, 2017
Updated. |
bors
commented
May 8, 2017
☔ The latest upstream changes (presumably #41745) made this pull request unmergeable. Please resolve the merge conflicts. |
arielb1
commented
May 9, 2017
Any particular reason this isn't a |
GuillaumeGomez
commented
May 9, 2017
@arielb1: I thought about it. So as you prefer. |
alexcrichton
commented
May 11, 2017
estebank
commented
May 12, 2017
@alexcrichtonthe difference in output at the moment is swapping the note and the label, but I have the same hangup as @arielb1 as I would rather avoid checking paths by string. That being said, @GuillaumeGomez I'd be down with setting |
GuillaumeGomez
commented
May 12, 2017
Ok so we definitely agree on this: If |
88082da to
7bb85e9CompareGuillaumeGomez
commented
May 15, 2017
Ok, updated. Let's see what the CI says. |
There was a problem hiding this comment.
Yep, I'm surprised about it but it seems that it fails otherwise because of the From<&str> not matching and auto-dereferencing a String.
There was a problem hiding this comment.
you should be able to use the format!() directly since #41745
There was a problem hiding this comment.
It's since my last rebase that I can't, so not sure...
estebank
commented
May 16, 2017
@GuillaumeGomezthe failing files are:
|
GuillaumeGomez
commented
May 16, 2017
@estebank: Ah great, thanks for the list! :) |
7bb85e9 to
747287aCompareGuillaumeGomez
commented
May 17, 2017
Updated. |
| | ^^^^^^^^^^^ no implementation for `{integer} + std::option::Option<{integer}>` | ||
| | | ||
| = note: no implementation for `{integer} + std::option::Option<{integer}>` | ||
| = help: the trait `std::ops::Add<std::option::Option<{integer}>>` is not implemented for `{integer}` |
There was a problem hiding this comment.
Do not prevent the merge of this PR, but reading this file I feel the full output of this error should be:
error[E0277]: the trait `std::ops::Add<std::option::Option<{integer}>>` is not implemented for `{integer}`
--> $DIR/binops.rs:12:5
|
12 | 1 + Some(1);
| ^^^^^^^^^^^ no implementation for `{integer} + std::option::Option<{integer}>`instead of
error[E0277]: the trait bound `{integer}: std::ops::Add<std::option::Option<{integer}>>` is not satisfied
--> $DIR/binops.rs:12:5
|
12 | 1 + Some(1);
| ^^^^^^^^^^^ no implementation for `{integer} + std::option::Option<{integer}>`
|
= help: the trait `std::ops::Add<std::option::Option<{integer}>>` is not implemented for `{integer}`Thoughts?
There was a problem hiding this comment.
I appreciate having both in case the user isn't well aware of the Add and equivalent traits.
carols10cents
commented
May 22, 2017
What's the current state of this PR please @GuillaumeGomez@estebank? I'm having trouble following :) |
estebank
commented
May 22, 2017
@carols10cents thanks for the ping @GuillaumeGomez can you post the visual diff of one of the modified cfail tests, like this one against the current nightly? I want to make sure that we're not removing information. If the new output looks fine for that, I'll r+. |
GuillaumeGomez
commented
May 22, 2017
Sure. Here it is: And the old one: |
estebank
commented
May 23, 2017
@bors r+ |
bors
commented
May 23, 2017
📌 Commit 747287a has been approved by |
bors
commented
May 23, 2017
⌛ Testing commit 747287a with merge 2e91391... |
Add better error message when == operator is badly used Part of #40660. With the following code: ```rust fn foo<T: PartialEq>(a: &T, b: T) { a == b; } fn main() { foo(&1, 1); } ``` It prints: ``` error[E0277]: the trait bound `&T: std::cmp::PartialEq<T>` is not satisfied --> test.rs:2:5 | 2 | a == b; | ^^^^^^ can't compare `&T` with `T` | = help: the trait `std::cmp::PartialEq<T>` is not implemented for `&T` = help: consider adding a `where &T: std::cmp::PartialEq<T>` bound error: aborting due to previous error ```
bors
commented
May 23, 2017
☀️ Test successful - status-appveyor, status-travis |

Part of #40660.
With the following code:
It prints: