Rework -Zremap-path-scope
macro test with dependency check · rust-lang/rust@e534797 (original) (raw)
``
1
`` +
// This test exercises -Zremap-path-scope
, macros (like file!()) and dependency.
``
``
2
`+
//
`
``
3
`+
// We test different combinations with/without remap in deps, with/without remap in
`
``
4
`+
// this crate but always in deps and always here but never in deps.
`
``
5
+
1
6
`//@ run-pass
`
2
7
`//@ check-run-results
`
3
8
``
4
``
`-
//@ revisions: normal with-macro-scope without-macro-scope
`
5
``
`-
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
`
6
``
`-
//@ [with-macro-scope]compile-flags: -Zremap-path-scope=macro,diagnostics
`
7
``
`-
//@ [without-macro-scope]compile-flags: -Zremap-path-scope=diagnostics
`
8
``
`-
// no-remap-src-base: Manually remap, so the remapped path remains in .stderr file.
`
``
9
`+
//@ revisions: with-diag-in-deps with-macro-in-deps with-debuginfo-in-deps
`
``
10
`+
//@ revisions: only-diag-in-deps only-macro-in-deps only-debuginfo-in-deps
`
``
11
`+
//@ revisions: not-macro-in-deps
`
``
12
+
``
13
`+
//@[with-diag-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
`
``
14
`+
//@[with-macro-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
`
``
15
`+
//@[with-debuginfo-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
`
``
16
`+
//@[not-macro-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
`
``
17
+
``
18
`+
//@[with-diag-in-deps] compile-flags: -Zremap-path-scope=diagnostics
`
``
19
`+
//@[with-macro-in-deps] compile-flags: -Zremap-path-scope=macro
`
``
20
`+
//@[with-debuginfo-in-deps] compile-flags: -Zremap-path-scope=debuginfo
`
``
21
`+
//@[not-macro-in-deps] compile-flags: -Zremap-path-scope=macro
`
``
22
+
``
23
`+
//@[with-diag-in-deps] aux-build:file-diag.rs
`
``
24
`+
//@[with-macro-in-deps] aux-build:file-macro.rs
`
``
25
`+
//@[with-debuginfo-in-deps] aux-build:file-debuginfo.rs
`
``
26
`+
//@[only-diag-in-deps] aux-build:file-diag.rs
`
``
27
`+
//@[only-macro-in-deps] aux-build:file-macro.rs
`
``
28
`+
//@[only-debuginfo-in-deps] aux-build:file-debuginfo.rs
`
``
29
`+
//@[not-macro-in-deps] aux-build:file.rs
`
``
30
+
``
31
`+
// The $SRC_DIR*.rs:LL:COL normalisation doesn't kick in automatically
`
``
32
`+
// as the remapped revision will not begin with $SRC_DIR_REAL,
`
``
33
`+
// so we have to do it ourselves.
`
``
34
`+
//@ normalize-stderr: ".rs:\d+:\d+" -> ".rs:LL:COL"
`
``
35
+
``
36
`+
#[cfg(any(with_diag_in_deps, only_diag_in_deps))]
`
``
37
`+
extern crate file_diag as file;
`
``
38
+
``
39
`+
#[cfg(any(with_macro_in_deps, only_macro_in_deps))]
`
``
40
`+
extern crate file_macro as file;
`
``
41
+
``
42
`+
#[cfg(any(with_debuginfo_in_deps, only_debuginfo_in_deps))]
`
``
43
`+
extern crate file_debuginfo as file;
`
``
44
+
``
45
`+
#[cfg(not_macro_in_deps)]
`
``
46
`+
extern crate file;
`
9
47
``
10
48
`fn main() {
`
11
``
`-
println!("{}", file!());
`
``
49
`+
dbg!(file::my_file!());
`
``
50
`+
dbg!(file::file());
`
``
51
`+
dbg!(file!());
`
12
52
`}
`