Auto merge of #150343 - JonathanBrouwer:rollup-1mwkrdv, r=JonathanBrouwer

Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#150311 (Avoid using env::temp when linking a binary)
 - rust-lang/rust#150336 (Disable f16 on LoongArch for LLVM < 21)
 - rust-lang/rust#150338 (Include rustc version in ICE messages)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-12-24 13:21:20 +00:00
commit 24ac030a79
6 changed files with 14 additions and 16 deletions

View file

@ -383,6 +383,7 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
// Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>
(Arch::CSky, _) => false,
(Arch::Hexagon, _) if major < 21 => false, // (fixed in llvm21)
(Arch::LoongArch32 | Arch::LoongArch64, _) if major < 21 => false, // (fixed in llvm21)
(Arch::PowerPC | Arch::PowerPC64, _) => false,
(Arch::Sparc | Arch::Sparc64, _) => false,
(Arch::Wasm32 | Arch::Wasm64, _) => false,

View file

@ -103,17 +103,18 @@ pub fn link_binary(
});
if outputs.outputs.should_link() {
let tmpdir = TempDirBuilder::new()
.prefix("rustc")
.tempdir()
.unwrap_or_else(|error| sess.dcx().emit_fatal(errors::CreateTempDir { error }));
let path = MaybeTempDir::new(tmpdir, sess.opts.cg.save_temps);
let output = out_filename(
sess,
crate_type,
outputs,
codegen_results.crate_info.local_crate_name,
);
let tmpdir = TempDirBuilder::new()
.prefix("rustc")
.tempdir_in(output.parent().unwrap_or_else(|| Path::new(".")))
.unwrap_or_else(|error| sess.dcx().emit_fatal(errors::CreateTempDir { error }));
let path = MaybeTempDir::new(tmpdir, sess.opts.cg.save_temps);
let crate_name = format!("{}", codegen_results.crate_info.local_crate_name);
let out_filename = output.file_for_writing(
outputs,

View file

@ -1531,15 +1531,15 @@ fn report_ice(
.map(PathBuf::from)
.map(|env_var| session_diagnostics::IcePathErrorEnv { env_var }),
});
dcx.emit_note(session_diagnostics::IceVersion { version, triple: tuple });
None
}
}
} else {
dcx.emit_note(session_diagnostics::IceVersion { version, triple: tuple });
None
};
dcx.emit_note(session_diagnostics::IceVersion { version, triple: tuple });
if let Some((flags, excluded_cargo_defaults)) = rustc_session::utils::extra_compiler_flags() {
dcx.emit_note(session_diagnostics::IceFlags { flags: flags.join(" ") });
if excluded_cargo_defaults {

View file

@ -1,6 +1,6 @@
use std::ffi::{CString, OsStr};
use std::path::{Path, PathBuf, absolute};
use std::{env, fs, io};
use std::{fs, io};
use tempfile::TempDir;
@ -139,8 +139,4 @@ impl<'a, 'b> TempDirBuilder<'a, 'b> {
}
self.builder.tempdir_in(dir)
}
pub fn tempdir(&self) -> io::Result<TempDir> {
self.tempdir_in(env::temp_dir())
}
}

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));
}