]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/dep-graph-trait-impl-two-traits.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / compile-fail / dep-graph-trait-impl-two-traits.rs
CommitLineData
9cc50fc6
SL
1// Copyright 2012-2014 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 adding an impl to a trait `Foo` does not affect functions
12// that only use `Bar`, so long as they do not have methods in common.
13
54a0048b 14// compile-flags: -Z query-dep-graph
9cc50fc6
SL
15
16#![feature(rustc_attrs)]
17#![allow(warnings)]
18
19fn main() { }
20
21pub trait Foo: Sized {
22 fn foo(self) { }
23}
24
25pub trait Bar: Sized {
26 fn bar(self) { }
27}
28
29mod x {
30 use {Foo, Bar};
31
32 #[rustc_if_this_changed]
33 impl Foo for char { }
34
35 impl Bar for char { }
36}
37
38mod y {
39 use {Foo, Bar};
40
41 #[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR no path
42 pub fn call_bar() {
43 char::bar('a');
44 }
45}
46
47mod z {
48 use y;
49
50 #[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR no path
51 pub fn z() {
52 y::call_bar();
53 }
54}