]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/ich_resolve_results.rs
Rollup merge of #35558 - lukehinds:master, r=nikomatsakis
[rust.git] / src / test / incremental / ich_resolve_results.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 `mod3::bar` changes when we change the
12 // `use` to something different.
13
14 // revisions: rpass1 rpass2 rpass3
15
16 #![feature(rustc_attrs)]
17
18 fn test<T>() { }
19
20 mod mod1 {
21     pub struct Foo(pub u32);
22 }
23
24 mod mod2 {
25     pub struct Foo(pub i64);
26 }
27
28 #[cfg(rpass1)]
29 mod mod3 {
30     use test;
31     use mod1::Foo;
32
33     fn in_expr() {
34         Foo(0);
35     }
36
37     fn in_type() {
38         test::<Foo>();
39     }
40 }
41
42 #[cfg(rpass2)]
43 mod mod3 {
44     use mod1::Foo; // <-- Nothing changed, but reordered!
45     use test;
46
47     #[rustc_clean(label="Hir", cfg="rpass2")]
48     fn in_expr() {
49         Foo(0);
50     }
51
52     #[rustc_clean(label="Hir", cfg="rpass2")]
53     fn in_type() {
54         test::<Foo>();
55     }
56 }
57
58 #[cfg(rpass3)]
59 mod mod3 {
60     use test;
61     use mod2::Foo; // <-- This changed!
62
63     #[rustc_dirty(label="Hir", cfg="rpass3")]
64     fn in_expr() {
65         Foo(0);
66     }
67
68     #[rustc_dirty(label="Hir", cfg="rpass3")]
69     fn in_type() {
70         test::<Foo>();
71     }
72 }
73
74 fn main() { }