]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/remap_path_prefix/main.rs
Rollup merge of #53110 - Xanewok:save-analysis-remap-path, r=nrc
[rust.git] / src / test / codegen / remap_path_prefix / main.rs
1 // Copyright 2017 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 // ignore-windows
12 // ignore-tidy-linelength
13
14 // compile-flags: -g  -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{src-base}}=/the/src
15 // aux-build:remap_path_prefix_aux.rs
16
17 extern crate remap_path_prefix_aux;
18
19 // Here we check that submodules and include files are found using the path without
20 // remapping. This test requires that rustc is called with an absolute path.
21 mod aux_mod;
22 include!("aux_mod.rs");
23
24 // Here we check that the expansion of the file!() macro is mapped.
25 // CHECK: @0 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>, align 1
26 pub static FILE_PATH: &'static str = file!();
27
28 fn main() {
29     remap_path_prefix_aux::some_aux_function();
30     aux_mod::some_aux_mod_function();
31     some_aux_mod_function();
32 }
33
34 // Here we check that local debuginfo is mapped correctly.
35 // CHECK: !DIFile(filename: "/the/src/remap_path_prefix/main.rs", directory: "/the/cwd/")
36
37 // And here that debuginfo from other crates are expanded to absolute paths.
38 // CHECK: !DIFile(filename: "/the/aux-src/remap_path_prefix_aux.rs", directory: "")