Merge from rustc

This commit is contained in:
The Miri Cronjob Bot 2025-04-26 04:59:48 +00:00
commit 6c2fa0bce7
221 changed files with 3217 additions and 2142 deletions

View file

@ -414,13 +414,10 @@ pub struct Config {
/// ABI tests.
pub minicore_path: Utf8PathBuf,
/// If true, disable the "new" executor, and use the older libtest-based
/// executor to run tests instead. This is a temporary fallback, to make
/// manual comparative testing easier if bugs are found in the new executor.
///
/// FIXME(Zalathar): Eventually remove this flag and remove the libtest
/// dependency.
pub no_new_executor: bool,
/// If true, run tests with the "new" executor that was written to replace
/// compiletest's dependency on libtest. Eventually this will become the
/// default, and the libtest dependency will be removed.
pub new_executor: bool,
}
impl Config {

View file

@ -202,7 +202,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
"COMMAND",
)
.reqopt("", "minicore-path", "path to minicore aux library", "PATH")
.optflag("N", "no-new-executor", "disables the new test executor, and uses libtest instead")
.optflag("n", "new-executor", "enables the new test executor instead of using libtest")
.optopt(
"",
"debugger",
@ -448,7 +448,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
minicore_path: opt_path(matches, "minicore-path"),
no_new_executor: matches.opt_present("no-new-executor"),
new_executor: matches.opt_present("new-executor"),
}
}
@ -575,10 +575,9 @@ pub fn run_tests(config: Arc<Config>) {
// Delegate to the executor to filter and run the big list of test structures
// created during test discovery. When the executor decides to run a test,
// it will return control to the rest of compiletest by calling `runtest::run`.
let res = if !config.no_new_executor {
let res = if config.new_executor {
Ok(executor::run_tests(&config, tests))
} else {
// FIXME(Zalathar): Eventually remove the libtest executor entirely.
crate::executor::libtest::execute_tests(&config, tests)
};

View file

@ -53,7 +53,7 @@ fn main() {
// with `RustcPhase::Rustdoc`. There we perform a check-build (needed to get the expected
// build failures for `compile_fail` doctests) and then store a JSON file with the
// information needed to run this test.
// - We also set `--runtool` to ourselves, which ends up in `phase_runner` with
// - We also set `--test-runtool` to ourselves, which ends up in `phase_runner` with
// `RunnerPhase::Rustdoc`. There we parse the JSON file written in `phase_rustc` and invoke
// the Miri driver for interpretation.

View file

@ -666,8 +666,8 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
if arg == "--extern" {
// Patch --extern arguments to use *.rmeta files, since phase_cargo_rustc only creates stub *.rlib files.
forward_patched_extern_arg(&mut args, &mut cmd);
} else if arg == "--runtool" {
// An existing --runtool flag indicates cargo is running in cross-target mode, which we don't support.
} else if arg == "--test-runtool" {
// An existing --test-runtool flag indicates cargo is running in cross-target mode, which we don't support.
// Note that this is only passed when cargo is run with the unstable -Zdoctest-xcompile flag;
// otherwise, we won't be called as rustdoc at all.
show_error!("cross-interpreting doctests is not currently supported by Miri.");
@ -693,8 +693,8 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
// to let phase_cargo_rustc know to expect that. We'll use this environment variable as a flag:
cmd.env("MIRI_CALLED_FROM_RUSTDOC", "1");
// The `--test-builder` and `--runtool` arguments are unstable rustdoc features,
// which are disabled by default. We first need to enable them explicitly:
// The `--test-builder` is an unstable rustdoc features,
// which is disabled by default. We first need to enable them explicitly:
cmd.arg("-Zunstable-options");
// rustdoc needs to know the right sysroot.
@ -705,7 +705,7 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
// Make rustdoc call us back.
let cargo_miri_path = env::current_exe().expect("current executable path invalid");
cmd.arg("--test-builder").arg(&cargo_miri_path); // invoked by forwarding most arguments
cmd.arg("--runtool").arg(&cargo_miri_path); // invoked with just a single path argument
cmd.arg("--test-runtool").arg(&cargo_miri_path); // invoked with just a single path argument
debug_cmd("[cargo-miri rustdoc]", verbose, &cmd);
exec(cmd)

View file

@ -0,0 +1,47 @@
//! Tidy check to ensure that the commit SHA of the `src/gcc` submodule is the same as the
//! required GCC version of the GCC codegen backend.
use std::path::Path;
use std::process::Command;
pub fn check(root_path: &Path, compiler_path: &Path, bad: &mut bool) {
let cg_gcc_version_path = compiler_path.join("rustc_codegen_gcc/libgccjit.version");
let cg_gcc_version = std::fs::read_to_string(&cg_gcc_version_path)
.expect(&format!("Cannot read GCC version from {}", cg_gcc_version_path.display()))
.trim()
.to_string();
let git_output = Command::new("git")
.current_dir(root_path)
.arg("submodule")
.arg("status")
// --cached asks for the version that is actually committed in the repository, not the one
// that is currently checked out.
.arg("--cached")
.arg("src/gcc")
.output()
.expect("Cannot determine git SHA of the src/gcc checkout");
// This can return e.g.
// -e607be166673a8de9fc07f6f02c60426e556c5f2 src/gcc
// e607be166673a8de9fc07f6f02c60426e556c5f2 src/gcc (master-e607be166673a8de9fc07f6f02c60426e556c5f2.e607be)
// +e607be166673a8de9fc07f6f02c60426e556c5f2 src/gcc (master-e607be166673a8de9fc07f6f02c60426e556c5f2.e607be)
let git_output = String::from_utf8_lossy(&git_output.stdout)
.trim()
.split_whitespace()
.next()
.unwrap_or_default()
.to_string();
// The SHA can start with + if the submodule is modified or - if it is not checked out.
let gcc_submodule_sha = git_output.trim_start_matches(&['+', '-']);
if gcc_submodule_sha != cg_gcc_version {
*bad = true;
eprintln!(
r#"Commit SHA of the src/gcc submodule (`{gcc_submodule_sha}`) does not match the required GCC version of the GCC codegen backend (`{cg_gcc_version}`).
Make sure to set the src/gcc submodule to commit {cg_gcc_version}.
The GCC codegen backend commit is configured at {}."#,
cg_gcc_version_path.display(),
);
}
}

View file

@ -75,6 +75,7 @@ pub mod features;
pub mod fluent_alphabetical;
pub mod fluent_period;
mod fluent_used;
pub mod gcc_submodule;
pub(crate) mod iter_header;
pub mod known_bug;
pub mod mir_opt_tests;

View file

@ -116,6 +116,7 @@ fn main() {
check!(fluent_alphabetical, &compiler_path, bless);
check!(fluent_period, &compiler_path);
check!(target_policy, &root_path);
check!(gcc_submodule, &root_path, &compiler_path);
// Checks that only make sense for the std libs.
check!(pal, &library_path);