rust/tests/ui/traits/issue-8153.rs

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

17 lines
274 B
Rust
Raw Normal View History

// Test that duplicate methods in impls are not allowed
struct Foo;
trait Bar {
fn bar(&self) -> isize;
}
impl Bar for Foo {
fn bar(&self) -> isize {1}
2016-03-09 16:57:53 +00:00
fn bar(&self) -> isize {2} //~ ERROR duplicate definitions
}
fn main() {
println!("{}", Foo.bar());
}