]>
Commit | Line | Data |
---|---|---|
54a0048b SL |
1 | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | // Test that you cannot define items with the same name in overlapping inherent | |
12 | // impl blocks. | |
13 | ||
c30ab7b3 | 14 | #![allow(unused)] |
54a0048b SL |
15 | |
16 | struct Foo; | |
17 | ||
18 | impl Foo { | |
c30ab7b3 | 19 | fn id() {} //~ ERROR duplicate definitions |
54a0048b SL |
20 | //~^ WARN previously accepted |
21 | } | |
22 | ||
23 | impl Foo { | |
24 | fn id() {} | |
25 | } | |
26 | ||
27 | struct Bar<T>(T); | |
28 | ||
29 | impl<T> Bar<T> { | |
c30ab7b3 | 30 | fn bar(&self) {} //~ ERROR duplicate definitions |
54a0048b SL |
31 | //~^ WARN previously accepted |
32 | } | |
33 | ||
34 | impl Bar<u32> { | |
35 | fn bar(&self) {} | |
36 | } | |
37 | ||
38 | struct Baz<T>(T); | |
39 | ||
40 | impl<T: Copy> Baz<T> { | |
c30ab7b3 | 41 | fn baz(&self) {} //~ ERROR duplicate definitions |
54a0048b SL |
42 | //~^ WARN previously accepted |
43 | } | |
44 | ||
45 | impl<T> Baz<Vec<T>> { | |
46 | fn baz(&self) {} | |
47 | } | |
48 | ||
c30ab7b3 | 49 | fn main() {} |