E0034: provide disambiguated syntax for candidates#38168
E0034: provide disambiguated syntax for candidates#38168bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @nrc (rust_highfive has picked a reviewer for you, use r? to override) |
|
Seems good to me. I'll just wait for someone else's opinion. |
There was a problem hiding this comment.
In the None case here, could you pass an empty slice, and then not require Option<...>? If not, you should add a comment, explaining when and why to use None.
There was a problem hiding this comment.
I would make this a non-span help, since the span is already part of the error, I don't think it is necessary to show the span twice.
There was a problem hiding this comment.
Do you need to check for &mut here?
src/librustc_typeck/check/mod.rs
Outdated
There was a problem hiding this comment.
Why are there no args here? Is it just that we don't have access to them, or are they inappropriate?
There was a problem hiding this comment.
If the former, then I'd prefer to output foo(...) rather than foo()
There was a problem hiding this comment.
If the former, then I'd prefer to output foo(...) rather than foo()
This is the case now.
There was a problem hiding this comment.
I would change the text to "to disambiguate the method call, write ..."
src/librustc/ty/sty.rs
Outdated
There was a problem hiding this comment.
This might be better named is_mutable_pointer
6b5df90 to
e32f042
Compare
|
r=me, but failing tests |
For a given file
```rust
trait A { fn foo(&self) {} }
trait B : A { fn foo(&self) {} }
fn bar<T: B>(a: &T) {
a.foo()
}
```
provide the following output
```
error[E0034]: multiple applicable items in scope
--> file.rs:6:5
|
6 | a.foo(1)
| ^^^ multiple `foo` found
|
note: candidate rust-lang#1 is defined in the trait `A`
--> file.rs:2:11
|
2 | trait A { fn foo(&self, a: usize) {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to use it here write `A::foo(&a, 1)` instead
--> file.rs:6:5
|
6 | a.foo(1)
| ^^^
note: candidate rust-lang#2 is defined in the trait `B`
--> file.rs:3:15
|
3 | trait B : A { fn foo(&self, a: usize) {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to use it here write `B::foo(&a, 1)` instead
--> file.rs:6:5
|
6 | a.foo(1)
| ^^^
```
|
@nrc tests fixed after rebase/squash. |
|
@bors: r+ |
|
📌 Commit f595ea2 has been approved by |
E0034: provide disambiguated syntax for candidates
For a given file
```rust
trait A { fn foo(&self) {} }
trait B : A { fn foo(&self) {} }
fn bar<T: B>(a: &T) {
a.foo()
}
```
provide the following output
```
error[E0034]: multiple applicable items in scope
--> file.rs:6:5
|
6 | a.foo(1)
| ^^^ multiple `foo` found
|
note: candidate #1 is defined in the trait `A`
--> file.rs:2:11
|
2 | trait A { fn foo(&self, a: usize) {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to use it here write `A::foo(&a, 1)` instead
--> file.rs:6:5
|
6 | a.foo(1)
| ^^^
note: candidate #2 is defined in the trait `B`
--> file.rs:3:15
|
3 | trait B : A { fn foo(&self, a: usize) {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to use it here write `B::foo(&a, 1)` instead
--> file.rs:6:5
|
6 | a.foo(1)
| ^^^
```
Fix #37767.
|
☀️ Test successful - status-appveyor, status-travis |
For a given file
provide the following output
Fix #37767.