]> git.lizzy.rs Git - rust.git/commit
E0034: provide disambiguated syntax for candidates
authorEsteban Küber <esteban@kuber.com.ar>
Mon, 5 Dec 2016 02:10:59 +0000 (18:10 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Thu, 12 Jan 2017 22:54:05 +0000 (14:54 -0800)
commitf595ea25841eab1139ca10c5fe0349e51cc2b6c5
tree4cdd38c7b1134c4b16774f0406c918627ca9d51d
parent27b9e6d450590751fca863312a8cf10f289cf1f2
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)
  |     ^^^
```
src/librustc/ty/sty.rs
src/librustc_typeck/check/method/suggest.rs
src/librustc_typeck/check/mod.rs
src/test/compile-fail/issue-7575.rs [deleted file]
src/test/ui/span/issue-37767.rs [new file with mode: 0644]
src/test/ui/span/issue-37767.stderr [new file with mode: 0644]
src/test/ui/span/issue-7575.rs [new file with mode: 0644]
src/test/ui/span/issue-7575.stderr [new file with mode: 0644]