2016-02-26 16:01:16 -06:00
|
|
|
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
// Test that you cannot define items with the same name in overlapping inherent
|
|
|
|
// impl blocks.
|
|
|
|
|
2016-03-17 11:05:24 -05:00
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
|
2016-02-26 16:01:16 -06:00
|
|
|
struct Foo;
|
|
|
|
|
|
|
|
impl Foo {
|
2016-03-17 11:05:24 -05:00
|
|
|
fn id() {} //~ WARN duplicate definitions
|
|
|
|
//~^ WARN previously accepted
|
2016-02-26 16:01:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Foo {
|
|
|
|
fn id() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Bar<T>(T);
|
|
|
|
|
|
|
|
impl<T> Bar<T> {
|
2016-03-17 11:05:24 -05:00
|
|
|
fn bar(&self) {} //~ WARN duplicate definitions
|
|
|
|
//~^ WARN previously accepted
|
2016-02-26 16:01:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Bar<u32> {
|
|
|
|
fn bar(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Baz<T>(T);
|
|
|
|
|
|
|
|
impl<T: Copy> Baz<T> {
|
2016-03-17 11:05:24 -05:00
|
|
|
fn baz(&self) {} //~ WARN duplicate definitions
|
|
|
|
//~^ WARN previously accepted
|
2016-02-26 16:01:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> Baz<Vec<T>> {
|
|
|
|
fn baz(&self) {}
|
|
|
|
}
|
|
|
|
|
2016-03-17 11:05:24 -05:00
|
|
|
#[rustc_error]
|
|
|
|
fn main() {} //~ ERROR compilation successful
|