]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/inherent-overlap.rs
New upstream version 1.14.0+dfsg1
[rustc.git] / src / test / compile-fail / inherent-overlap.rs
CommitLineData
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
16struct Foo;
17
18impl Foo {
c30ab7b3 19 fn id() {} //~ ERROR duplicate definitions
54a0048b
SL
20 //~^ WARN previously accepted
21}
22
23impl Foo {
24 fn id() {}
25}
26
27struct Bar<T>(T);
28
29impl<T> Bar<T> {
c30ab7b3 30 fn bar(&self) {} //~ ERROR duplicate definitions
54a0048b
SL
31 //~^ WARN previously accepted
32}
33
34impl Bar<u32> {
35 fn bar(&self) {}
36}
37
38struct Baz<T>(T);
39
40impl<T: Copy> Baz<T> {
c30ab7b3 41 fn baz(&self) {} //~ ERROR duplicate definitions
54a0048b
SL
42 //~^ WARN previously accepted
43}
44
45impl<T> Baz<Vec<T>> {
46 fn baz(&self) {}
47}
48
c30ab7b3 49fn main() {}