Skip to content

Commit

Permalink
Auto merge of rust-lang#102028 - oli-obk:miri_subtree, r=oli-obk
Browse files Browse the repository at this point in the history
Make miri a subtree instead of a submodule

r? `@RalfJung`

fixes rust-lang#101867
fixes rust-lang#100134
  • Loading branch information
bors committed Sep 22, 2022
2 parents 3e50038 + 2ce88a5 commit c10f7d7
Show file tree
Hide file tree
Showing 1,211 changed files with 54,931 additions and 230 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
[submodule "src/doc/book"]
path = src/doc/book
url = https://github.com/rust-lang/book.git
[submodule "src/tools/miri"]
path = src/tools/miri
url = https://github.com/rust-lang/miri.git
[submodule "src/doc/rust-by-example"]
path = src/doc/rust-by-example
url = https://github.com/rust-lang/rust-by-example.git
Expand Down
2 changes: 1 addition & 1 deletion src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This directory contains the source code of the rust project, including:

- The test suite
- The bootstrapping build system
- Various submodules for tools, like cargo, miri, etc.
- Various submodules for tools, like cargo, etc.

For more information on how various parts of the compiler work, see the [rustc dev guide].

Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InT
// behavior, treat it as in-tree so that any new warnings in clippy will be
// rejected.
tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree);
// Miri on the other hand is treated as out of tree, since InTree also causes it to
// be run as part of `check`, which can fail on platforms which libffi-sys has no support for.
tool_check_step!(Miri, "src/tools/miri", SourceType::Submodule);
tool_check_step!(Rls, "src/tools/rls", SourceType::InTree);
tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree);
Expand Down
83 changes: 28 additions & 55 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@ pub fn tmpdir(builder: &Builder<'_>) -> PathBuf {
builder.out.join("tmp/dist")
}

fn missing_tool(tool_name: &str, skip: bool) {
if skip {
println!("Unable to build {}, skipping dist", tool_name)
} else {
let help = "note: not all tools are available on all nightlies\nhelp: see https://forge.rust-lang.org/infra/toolstate.html for more information";
panic!(
"Unable to build submodule tool {} (use `missing-tools = true` to ignore this failure)\n{}",
tool_name, help
)
}
}

fn should_build_extended_tool(builder: &Builder<'_>, tool: &str) -> bool {
if !builder.config.extended {
return false;
Expand Down Expand Up @@ -1209,18 +1197,9 @@ impl Step for Miri {
let compiler = self.compiler;
let target = self.target;

let miri = builder
.ensure(tool::Miri { compiler, target, extra_features: Vec::new() })
.or_else(|| {
missing_tool("miri", builder.build.config.missing_tools);
None
})?;
let cargomiri = builder
.ensure(tool::CargoMiri { compiler, target, extra_features: Vec::new() })
.or_else(|| {
missing_tool("cargo miri", builder.build.config.missing_tools);
None
})?;
let miri = builder.ensure(tool::Miri { compiler, target, extra_features: Vec::new() })?;
let cargomiri =
builder.ensure(tool::CargoMiri { compiler, target, extra_features: Vec::new() })?;

let mut tarball = Tarball::new(builder, "miri", &target.triple);
tarball.set_overlay(OverlayKind::Miri);
Expand Down Expand Up @@ -1451,7 +1430,7 @@ impl Step for Extended {

let xform = |p: &Path| {
let mut contents = t!(fs::read_to_string(p));
for tool in &["rust-demangler", "rust-analyzer", "miri", "rustfmt"] {
for tool in &["rust-demangler", "rust-analyzer", "rustfmt"] {
if !built_tools.contains(tool) {
contents = filter(&contents, tool);
}
Expand Down Expand Up @@ -1491,7 +1470,8 @@ impl Step for Extended {
prepare("rust-std");
prepare("rust-analysis");
prepare("clippy");
for tool in &["rust-docs", "rust-demangler", "rust-analyzer", "miri"] {
prepare("miri");
for tool in &["rust-docs", "rust-demangler", "rust-analyzer"] {
if built_tools.contains(tool) {
prepare(tool);
}
Expand Down Expand Up @@ -1550,7 +1530,8 @@ impl Step for Extended {
prepare("rust-docs");
prepare("rust-std");
prepare("clippy");
for tool in &["rust-demangler", "rust-analyzer", "miri"] {
prepare("miri");
for tool in &["rust-demangler", "rust-analyzer"] {
if built_tools.contains(tool) {
prepare(tool);
}
Expand Down Expand Up @@ -1689,25 +1670,23 @@ impl Step for Extended {
.arg(etc.join("msi/remove-duplicates.xsl")),
);
}
if built_tools.contains("miri") {
builder.run(
Command::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("miri")
.args(&heat_flags)
.arg("-cg")
.arg("MiriGroup")
.arg("-dr")
.arg("Miri")
.arg("-var")
.arg("var.MiriDir")
.arg("-out")
.arg(exe.join("MiriGroup.wxs"))
.arg("-t")
.arg(etc.join("msi/remove-duplicates.xsl")),
);
}
builder.run(
Command::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("miri")
.args(&heat_flags)
.arg("-cg")
.arg("MiriGroup")
.arg("-dr")
.arg("Miri")
.arg("-var")
.arg("var.MiriDir")
.arg("-out")
.arg(exe.join("MiriGroup.wxs"))
.arg("-t")
.arg(etc.join("msi/remove-duplicates.xsl")),
);
builder.run(
Command::new(&heat)
.current_dir(&exe)
Expand Down Expand Up @@ -1755,6 +1734,7 @@ impl Step for Extended {
.arg("-dStdDir=rust-std")
.arg("-dAnalysisDir=rust-analysis")
.arg("-dClippyDir=clippy")
.arg("-dMiriDir=miri")
.arg("-arch")
.arg(&arch)
.arg("-out")
Expand All @@ -1768,9 +1748,6 @@ impl Step for Extended {
if built_tools.contains("rust-analyzer") {
cmd.arg("-dRustAnalyzerDir=rust-analyzer");
}
if built_tools.contains("miri") {
cmd.arg("-dMiriDir=miri");
}
if target.ends_with("windows-gnu") {
cmd.arg("-dGccDir=rust-mingw");
}
Expand All @@ -1784,15 +1761,13 @@ impl Step for Extended {
candle("CargoGroup.wxs".as_ref());
candle("StdGroup.wxs".as_ref());
candle("ClippyGroup.wxs".as_ref());
candle("MiriGroup.wxs".as_ref());
if built_tools.contains("rust-demangler") {
candle("RustDemanglerGroup.wxs".as_ref());
}
if built_tools.contains("rust-analyzer") {
candle("RustAnalyzerGroup.wxs".as_ref());
}
if built_tools.contains("miri") {
candle("MiriGroup.wxs".as_ref());
}
candle("AnalysisGroup.wxs".as_ref());

if target.ends_with("windows-gnu") {
Expand Down Expand Up @@ -1822,6 +1797,7 @@ impl Step for Extended {
.arg("StdGroup.wixobj")
.arg("AnalysisGroup.wixobj")
.arg("ClippyGroup.wixobj")
.arg("MiriGroup.wixobj")
.current_dir(&exe);

if built_tools.contains("rust-analyzer") {
Expand All @@ -1830,9 +1806,6 @@ impl Step for Extended {
if built_tools.contains("rust-demangler") {
cmd.arg("RustDemanglerGroup.wixobj");
}
if built_tools.contains("miri") {
cmd.arg("MiriGroup.wixobj");
}

if target.ends_with("windows-gnu") {
cmd.arg("GccGroup.wixobj");
Expand Down
11 changes: 4 additions & 7 deletions src/bootstrap/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,10 @@ install!((self, builder, _config),
install_sh(builder, "clippy", self.compiler.stage, Some(self.target), &tarball);
};
Miri, alias = "miri", Self::should_build(_config), only_hosts: true, {
if let Some(tarball) = builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }) {
install_sh(builder, "miri", self.compiler.stage, Some(self.target), &tarball);
} else {
builder.info(
&format!("skipping Install miri stage{} ({})", self.compiler.stage, self.target),
);
}
let tarball = builder
.ensure(dist::Miri { compiler: self.compiler, target: self.target })
.expect("missing miri");
install_sh(builder, "miri", self.compiler.stage, Some(self.target), &tarball);
};
Rustfmt, alias = "rustfmt", Self::should_build(_config), only_hosts: true, {
if let Some(tarball) = builder.ensure(dist::Rustfmt {
Expand Down
9 changes: 2 additions & 7 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,13 +542,8 @@ impl Build {

// Make sure we update these before gathering metadata so we don't get an error about missing
// Cargo.toml files.
let rust_submodules = [
"src/tools/rust-installer",
"src/tools/cargo",
"src/tools/miri",
"library/backtrace",
"library/stdarch",
];
let rust_submodules =
["src/tools/rust-installer", "src/tools/cargo", "library/backtrace", "library/stdarch"];
for s in rust_submodules {
build.update_submodule(Path::new(s));
}
Expand Down
Loading

0 comments on commit c10f7d7

Please sign in to comment.