From bfd148b783febe248f4d601c8d9d542348345bf0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 18 Jul 2022 17:47:32 -0400 Subject: [PATCH] use env vars, not Cargo.toml, to configure out dev profile --- Cargo.toml | 5 +++-- miri | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a2a880f8e30..208b3a76443 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,5 +56,6 @@ harness = false default = ["stack-cache"] stack-cache = [] -[profile.dev] -opt-level = 2 # because it's too slow otherwise +# Be aware that this file is inside a workspace when used via the +# submodule in the rustc repo. That means there are many cargo features +# we cannot use, such as profiles. diff --git a/miri b/miri index bb2fc5b1231..04d441b6078 100755 --- a/miri +++ b/miri @@ -96,10 +96,14 @@ fi # Prepare flags for cargo and rustc. CARGO="cargo +$TOOLCHAIN" +# Share target dir between `miri` and `cargo-miri`. if [ -z "$CARGO_TARGET_DIR" ]; then - # Share target dir between `miri` and `cargo-miri`. export CARGO_TARGET_DIR="$MIRIDIR/target" fi +# We configure dev builds to not be unusably slow. +if [ -z "$CARGO_PROFILE_DEV_OPT_LEVEL" ]; then + export CARGO_PROFILE_DEV_OPT_LEVEL=2 +fi # We set the rpath so that Miri finds the private rustc libraries it needs. export RUSTFLAGS="-C link-args=-Wl,-rpath,$LIBDIR $RUSTFLAGS"