Skip to content

Commit 1f0a672

Browse files
committed
bump rustc-build-sysroot
1 parent 724c1a0 commit 1f0a672

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

src/tools/miri/cargo-miri/Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ dependencies = [
175175

176176
[[package]]
177177
name = "rustc-build-sysroot"
178-
version = "0.3.3"
178+
version = "0.4.0"
179179
source = "registry+https://github.com/rust-lang/crates.io-index"
180-
checksum = "ec5f3689b6c560d6a3a17fcbe54204cd870b4fcf46342d60de16715b660d2c92"
180+
checksum = "20c4b4625eeb148cccf82d5e9b90ad7fab3b11a0204cf75cc7fa04981a0fdffd"
181181
dependencies = [
182182
"anyhow",
183183
"rustc_version",

src/tools/miri/cargo-miri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ directories = "4"
1818
rustc_version = "0.4"
1919
serde_json = "1.0.40"
2020
cargo_metadata = "0.15.0"
21-
rustc-build-sysroot = "0.3.3"
21+
rustc-build-sysroot = "0.4"
2222

2323
# A noop dependency that changes in the Rust repository, it's a bit of a hack.
2424
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`

src/tools/miri/cargo-miri/src/setup.rs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::ffi::OsStr;
55
use std::path::PathBuf;
66
use std::process::{self, Command};
77

8-
use rustc_build_sysroot::{BuildMode, Sysroot, SysrootConfig};
8+
use rustc_build_sysroot::{BuildMode, SysrootBuilder, SysrootConfig};
99
use rustc_version::VersionMeta;
1010

1111
use crate::util::*;
@@ -67,9 +67,11 @@ pub fn setup(subcommand: &MiriCommand, target: &str, rustc_version: &VersionMeta
6767
let sysroot_config = if std::env::var_os("MIRI_NO_STD").is_some() {
6868
SysrootConfig::NoStd
6969
} else {
70-
SysrootConfig::WithStd { std_features: &["panic_unwind", "backtrace"] }
70+
SysrootConfig::WithStd {
71+
std_features: ["panic_unwind", "backtrace"].into_iter().map(Into::into).collect(),
72+
}
7173
};
72-
let cargo_cmd = || {
74+
let cargo_cmd = {
7375
let mut command = cargo();
7476
// Use Miri as rustc to build a libstd compatible with us (and use the right flags).
7577
// However, when we are running in bootstrap, we cannot just overwrite `RUSTC`,
@@ -103,13 +105,14 @@ pub fn setup(subcommand: &MiriCommand, target: &str, rustc_version: &VersionMeta
103105
command.stdout(process::Stdio::null());
104106
command.stderr(process::Stdio::null());
105107
}
106-
// Disable debug assertions in the standard library -- Miri is already slow enough.
107-
// But keep the overflow checks, they are cheap. This completely overwrites flags
108-
// the user might have set, which is consistent with normal `cargo build` that does
109-
// not apply `RUSTFLAGS` to the sysroot either.
110-
let rustflags = vec!["-Cdebug-assertions=off".into(), "-Coverflow-checks=on".into()];
111-
(command, rustflags)
108+
109+
command
112110
};
111+
// Disable debug assertions in the standard library -- Miri is already slow enough.
112+
// But keep the overflow checks, they are cheap. This completely overwrites flags
113+
// the user might have set, which is consistent with normal `cargo build` that does
114+
// not apply `RUSTFLAGS` to the sysroot either.
115+
let rustflags = &["-Cdebug-assertions=off", "-Coverflow-checks=on"];
113116
// Make sure all target-level Miri invocations know their sysroot.
114117
std::env::set_var("MIRI_SYSROOT", sysroot_dir);
115118

@@ -121,8 +124,13 @@ pub fn setup(subcommand: &MiriCommand, target: &str, rustc_version: &VersionMeta
121124
// We want to be quiet, but still let the user know that something is happening.
122125
eprint!("Preparing a sysroot for Miri (target: {target})... ");
123126
}
124-
Sysroot::new(sysroot_dir, target)
125-
.build_from_source(&rust_src, BuildMode::Check, sysroot_config, rustc_version, cargo_cmd)
127+
SysrootBuilder::new(sysroot_dir, target)
128+
.build_mode(BuildMode::Check)
129+
.rustc_version(rustc_version.clone())
130+
.sysroot_config(sysroot_config)
131+
.rustflags(rustflags)
132+
.cargo(cargo_cmd)
133+
.build_from_source(&rust_src)
126134
.unwrap_or_else(|_| {
127135
if only_setup {
128136
show_error!("failed to build sysroot, see error details above")

0 commit comments

Comments
 (0)