]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/source_loc_macros.rs
Merge branch 'master' into redox
[rust.git] / src / test / incremental / source_loc_macros.rs
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 // This test makes sure that different expansions of the file!(), line!(),
12 // column!() macros get picked up by the incr. comp. hash.
13
14 // revisions:rpass1 rpass2
15
16 // compile-flags: -Z query-dep-graph
17
18 #![feature(rustc_attrs)]
19
20 #[rustc_clean(label="Hir", cfg="rpass2")]
21 #[rustc_clean(label="HirBody", cfg="rpass2")]
22 fn line_same() {
23     let _ = line!();
24 }
25
26 #[rustc_clean(label="Hir", cfg="rpass2")]
27 #[rustc_clean(label="HirBody", cfg="rpass2")]
28 fn col_same() {
29     let _ = column!();
30 }
31
32 #[rustc_clean(label="Hir", cfg="rpass2")]
33 #[rustc_clean(label="HirBody", cfg="rpass2")]
34 fn file_same() {
35     let _ = file!();
36 }
37
38 #[cfg(rpass1)]
39 fn line_different() {
40     let _ = line!();
41 }
42
43 #[cfg(rpass2)]
44 #[rustc_clean(label="Hir", cfg="rpass2")]
45 #[rustc_dirty(label="HirBody", cfg="rpass2")]
46 fn line_different() {
47     let _ = line!();
48 }
49
50 #[cfg(rpass1)]
51 fn col_different() {
52     let _ = column!();
53 }
54
55 #[cfg(rpass2)]
56 #[rustc_clean(label="Hir", cfg="rpass2")]
57 #[rustc_dirty(label="HirBody", cfg="rpass2")]
58 fn col_different() {
59     let _ =        column!();
60 }
61
62 fn main() {
63     line_same();
64     line_different();
65     col_same();
66     col_different();
67     file_same();
68 }