Skip to content

Commit d6b46bf

Browse files
committed
test(trim-paths): demonstrate not work properly with -Zbuild-std
1 parent b4c2bef commit d6b46bf

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/build-std/main.rs

+43
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,46 @@ fn custom_test_framework() {
229229
.build_std_arg("core")
230230
.run();
231231
}
232+
233+
// Fixing rust-lang/rust#117839.
234+
// on macOS it never gets remapped.
235+
// Might be a separate issue, so only run on Linux.
236+
#[cargo_test(build_std_real)]
237+
#[cfg(target_os = "linux")]
238+
fn remap_path_scope() {
239+
let p = project()
240+
.file(
241+
"src/main.rs",
242+
"
243+
fn main() {
244+
panic!(\"remap to /rustc/<hash>\");
245+
}
246+
",
247+
)
248+
.file(
249+
".cargo/config.toml",
250+
"
251+
[profile.release]
252+
debug = \"line-tables-only\"
253+
",
254+
)
255+
.build();
256+
257+
p.cargo("run --release -Ztrim-paths")
258+
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
259+
.env("RUST_BACKTRACE", "1")
260+
.build_std()
261+
.target_host()
262+
.with_status(101)
263+
.with_stderr_contains(
264+
"\
265+
[FINISHED] release [optimized + debuginfo] [..]
266+
[RUNNING] [..]
267+
[..]thread '[..]' panicked at [..]src/main.rs:3:[..]",
268+
)
269+
.with_stderr_contains("remap to /rustc/<hash>")
270+
.with_stderr_contains("[..]at std-0.0.0/src/[..]")
271+
.with_stderr_contains("[..]at src/main.rs:3[..]")
272+
.with_stderr_contains("[..]at core-0.0.0/src/[..]")
273+
.run();
274+
}

0 commit comments

Comments
 (0)