rust/tests/ui/issues/issue-18446.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
360 B
Rust
Raw Normal View History

// Test that name clashes between the method in an impl for the type
// and the method in the trait when both are in the same scope.
trait T {
fn foo(&self);
}
2019-05-28 13:46:13 -05:00
impl<'a> dyn T + 'a {
fn foo(&self) {}
}
impl T for i32 {
fn foo(&self) {}
}
fn main() {
2019-05-28 13:46:13 -05:00
let x: &dyn T = &0i32;
x.foo(); //~ ERROR multiple applicable items in scope [E0034]
}