]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/source_loc_macros.rs
Rollup merge of #56476 - GuillaumeGomez:invalid-line-number-match, r=QuietMisdreavus
[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 #[rustc_clean(label="Hir", cfg="rpass2")]
39 #[rustc_dirty(label="HirBody", cfg="rpass2")]
40 fn line_different() {
41     #[cfg(rpass1)]
42     {
43         let _ = line!();
44     }
45     #[cfg(rpass2)]
46     {
47         let _ = line!();
48     }
49 }
50
51 #[rustc_clean(label="Hir", cfg="rpass2")]
52 #[rustc_dirty(label="HirBody", cfg="rpass2")]
53 fn col_different() {
54     #[cfg(rpass1)]
55     {
56         let _ = column!();
57     }
58     #[cfg(rpass2)]
59     {
60         let _ =        column!();
61     }
62 }
63
64 fn main() {
65     line_same();
66     line_different();
67     col_same();
68     col_different();
69     file_same();
70 }