]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/ich_method_call_trait_scope.rs
Rollup merge of #50979 - Manishearth:type-only, r=estebank
[rust.git] / src / test / incremental / ich_method_call_trait_scope.rs
1 // Copyright 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 // Check that the hash for a method call is sensitive to the traits in
12 // scope.
13
14 // revisions: rpass1 rpass2
15 // compile-flags: -Z query-dep-graph
16
17 #![feature(rustc_attrs)]
18
19 fn test<T>() { }
20
21 trait Trait1 {
22     fn method(&self) { }
23 }
24
25 impl Trait1 for () { }
26
27 trait Trait2 {
28     fn method(&self) { }
29 }
30
31 impl Trait2 for () { }
32
33 mod mod3 {
34     #[cfg(rpass1)]
35     use Trait1;
36     #[cfg(rpass2)]
37     use Trait2;
38
39     #[rustc_clean(label="Hir", cfg="rpass2")]
40     #[rustc_clean(label="HirBody", cfg="rpass2")]
41     #[rustc_dirty(label="TypeckTables", cfg="rpass2")]
42     fn bar() {
43         ().method();
44     }
45
46     #[rustc_clean(label="Hir", cfg="rpass2")]
47     #[rustc_clean(label="HirBody", cfg="rpass2")]
48     #[rustc_clean(label="TypeckTables", cfg="rpass2")]
49     fn baz() {
50         22; // no method call, traits in scope don't matter
51     }
52 }
53
54 fn main() { }