Avoid using env::temp when linking a binary

This keeps all build artefacts (even temporary ones) within the build directory.
This commit is contained in:
Chris Denton 2025-12-23 15:50:33 +00:00
parent eb171a227f
commit b5c473e414
No known key found for this signature in database
GPG key ID: 713472F2F45627DE
3 changed files with 11 additions and 14 deletions

View file

@ -1,9 +1,7 @@
//@ needs-target-std
//
// When the TMP (on Windows) or TMPDIR (on Unix) variable is set to an invalid
// or non-existing directory, this used to cause an internal compiler error (ICE). After the
// addition of proper error handling in #28430, this test checks that the expected message is
// printed.
// or non-existing directory, this used to cause an internal compiler error (ICE).
// See https://github.com/rust-lang/rust/issues/14698
use run_make_support::{is_windows, rustc};
@ -18,5 +16,7 @@ fn main() {
} else {
rustc.env("TMPDIR", "fake");
}
rustc.input("foo.rs").run_fail().assert_stderr_contains("couldn't create a temp dir");
let result = rustc.input("foo.rs").run_unchecked();
// Ensure that rustc doesn't ICE by checking the exit code isn't 101.
assert_ne!(result.status().code(), Some(101));
}