rust/tests/ui/codemap_tests/overlapping_inherent_impls.rs

37 lines
508 B
Rust
Raw Normal View History

// Test that you cannot define items with the same name in overlapping inherent
// impl blocks.
#![allow(unused)]
struct Foo;
impl Foo {
2017-11-20 06:13:27 -06:00
fn id() {} //~ ERROR duplicate definitions
}
impl Foo {
fn id() {}
}
struct Bar<T>(T);
impl<T> Bar<T> {
2017-11-20 06:13:27 -06:00
fn bar(&self) {} //~ ERROR duplicate definitions
}
impl Bar<u32> {
fn bar(&self) {}
}
struct Baz<T>(T);
impl<T: Copy> Baz<T> {
2017-11-20 06:13:27 -06:00
fn baz(&self) {} //~ ERROR duplicate definitions
}
impl<T> Baz<Vec<T>> {
fn baz(&self) {}
}
fn main() {}