Skip to content

Commit 5b02abb

Browse files
committed
Add test for --remap-path-prefix on std imports
1 parent 48691ea commit 5b02abb

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// ignore-tidy-linelength
2+
3+
// compile-flags: -g --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/home/USERNAME/TOOLCHAIN/lib/rustlib/src/rust/library/std/src
4+
5+
#[inline]
6+
pub fn some_std_function() -> i32 {
7+
1234
8+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// ignore-windows
2+
// ignore-tidy-linelength
3+
4+
// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix=/home/USERNAME=REDACTED
5+
// aux-build:pseudo_std.rs
6+
7+
extern crate pseudo_std;
8+
// Here we check that imported code from std has their path remapped.
9+
// If we were to use an actual std function to test, we'd have to remap {{cwd}}/library/...,
10+
// but that will break if rustc was built with remap-debuginfo = true in config.toml.
11+
// Hence we simulate the path rust-src would take in a real linux installation
12+
// by remapping the prefix inside pseudo_std.rs
13+
// CHECK: !DIFile(filename: "REDACTED/TOOLCHAIN/lib/rustlib/src/rust/library/std/src/pseudo_std.rs", directory: ""
14+
fn main() {
15+
pseudo_std::some_std_function();
16+
}

0 commit comments

Comments
 (0)