Skip to content

Commit 68fc65e

Browse files
committed
Prevent distribution if miri is enabled
1 parent 13921da commit 68fc65e

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/bootstrap/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<'a> Builder<'a> {
260260
doc::Reference, doc::Rustdoc, doc::CargoBook),
261261
Kind::Dist => describe!(dist::Docs, dist::Mingw, dist::Rustc, dist::DebuggerScripts,
262262
dist::Std, dist::Analysis, dist::Src, dist::PlainSourceTarball, dist::Cargo,
263-
dist::Rls, dist::Extended, dist::HashSign),
263+
dist::Rls, dist::Extended, dist::HashSign, dist::DontDistWithMiriEnabled),
264264
Kind::Install => describe!(install::Docs, install::Std, install::Cargo, install::Rls,
265265
install::Analysis, install::Src, install::Rustc),
266266
}

src/bootstrap/dist.rs

+25
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,31 @@ impl Step for Rls {
11111111
}
11121112
}
11131113

1114+
1115+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1116+
pub struct DontDistWithMiriEnabled;
1117+
1118+
impl Step for DontDistWithMiriEnabled {
1119+
type Output = PathBuf;
1120+
const DEFAULT: bool = true;
1121+
1122+
fn should_run(run: ShouldRun) -> ShouldRun {
1123+
let build_miri = run.builder.build.config.test_miri;
1124+
run.default_condition(build_miri)
1125+
}
1126+
1127+
fn make_run(run: RunConfig) {
1128+
run.builder.ensure(DontDistWithMiriEnabled);
1129+
}
1130+
1131+
fn run(self, _: &Builder) -> PathBuf {
1132+
panic!("Do not distribute with miri enabled.\n\
1133+
The distributed libraries would include all MIR (increasing binary size).
1134+
The distributed MIR would include validation statements.");
1135+
}
1136+
}
1137+
1138+
11141139
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
11151140
pub struct Extended {
11161141
stage: u32,

0 commit comments

Comments
 (0)