From 6ccf03c843fc252a58055e71b2057aaa42cdb464 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 11 Mar 2016 16:03:28 -0800 Subject: [PATCH 1/4] rustbuild: Fix 32-bit Windows build Unfortunately on i686-pc-windows-gnu LLVM's answer to `--host-target` is `x86_64-pc-windows-gnu` even though we're building in a 32-bit shell as well as compiling 32-bit libraries. For now use Cargo's `HOST` environment variable to determine whether we're doing a cross compilation or not. --- src/librustc_llvm/build.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 59164161b3d5e..dcfb518ba7938 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -47,14 +47,20 @@ fn main() { // the host platform. This only really works if the host LLVM and target // LLVM are compiled the same way, but for us that's typically the case. // - // We detect this cross compiling situation by asking llvm-config what it's - // host-target is. If that's not the TARGET, then we're cross compiling. - // This generally just means that we can't trust all the output of - // llvm-config becaues it might be targeted for the host rather than the - // target. + // We *want* detect this cross compiling situation by asking llvm-config + // what it's host-target is. If that's not the TARGET, then we're cross + // compiling. Unfortunately `llvm-config` seems either be buggy, or we're + // misconfiguring it, because the `i686-pc-windows-gnu` build of LLVM will + // report itself with a `--host-target` of `x86_64-pc-windows-gnu`. This + // tricks us into thinking we're doing a cross build when we aren't, so + // havoc ensues. + // + // In any case, if we're cross compiling, this generally just means that we + // can't trust all the output of llvm-config becaues it might be targeted + // for the host rather than the target. As a result a bunch of blocks below + // are gated on `if !is_crossed` let target = env::var("TARGET").unwrap(); - let host = output(Command::new(&llvm_config).arg("--host-target")); - let host = host.trim(); + let host = env::var("HOST").unwrap(); let is_crossed = target != host; let optional_components = ["x86", "arm", "aarch64", "mips", "powerpc", From 4a917e050d62e0b5a66c0d392992cc5e1d4b1e5d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 11 Mar 2016 16:21:05 -0800 Subject: [PATCH 2/4] rustbuild: Use tool_cmd() instead of tool() This sets up the dynamic loader path for dylibs required, so should fix the MSVC build right now. --- src/bootstrap/build/check.rs | 7 ++----- src/bootstrap/build/doc.rs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/build/check.rs b/src/bootstrap/build/check.rs index 19293e80217e3..a50b09bcdef13 100644 --- a/src/bootstrap/build/check.rs +++ b/src/bootstrap/build/check.rs @@ -8,14 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::process::Command; - use build::{Build, Compiler}; pub fn linkcheck(build: &Build, stage: u32, host: &str) { println!("Linkcheck stage{} ({})", stage, host); let compiler = Compiler::new(stage, host); - let linkchecker = build.tool(&compiler, "linkchecker"); - build.run(Command::new(&linkchecker) - .arg(build.out.join(host).join("doc"))); + build.run(build.tool_cmd(&compiler, "linkchecker") + .arg(build.out.join(host).join("doc"))); } diff --git a/src/bootstrap/build/doc.rs b/src/bootstrap/build/doc.rs index 51bf752e06d34..84de48255413c 100644 --- a/src/bootstrap/build/doc.rs +++ b/src/bootstrap/build/doc.rs @@ -143,7 +143,7 @@ pub fn rustc(build: &Build, stage: u32, host: &str, out: &Path) { pub fn error_index(build: &Build, stage: u32, host: &str, out: &Path) { println!("Documenting stage{} error index ({})", stage, host); let compiler = Compiler::new(stage, host); - let mut index = Command::new(build.tool(&compiler, "error_index_generator")); + let mut index = build.tool_cmd(&compiler, "error_index_generator"); index.arg("html"); index.arg(out.join("error-index.html")); From 8cd1c17d90c616a530a6e2aed559b3efecb3c2e0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 11 Mar 2016 17:30:16 -0800 Subject: [PATCH 3/4] rustbuild: Refactor stage arguments away The facet of a stage is rarely relevant when running a tool or building something, it's all a question of what stage the *compiler* is built in. We've already got a nice handy `Compiler` structure to carry this information, so let's use it! This refactors the signature of the `Build::cargo` function two ways: 1. The `stage` argument is removed, this was just duplicated with the `compiler` argument's stage field. 2. The `target` argument is now required. This was a bug where if the `--target` flag isn't passed then the snapshot stage0 compiler is always used, so we won't pick up any changes. Much of the other changes in this commit are just propagating these decisions outwards. For example many of the `Step` variants no longer have a stage argument as they're baked into the compiler. --- src/bootstrap/build/compile.rs | 67 +++++++++--------- src/bootstrap/build/doc.rs | 11 ++- src/bootstrap/build/mod.rs | 123 ++++++++++++++------------------- src/bootstrap/build/step.rs | 42 +++++------ src/nightlies.txt | 2 +- src/rustc/Cargo.lock | 1 - 6 files changed, 110 insertions(+), 136 deletions(-) diff --git a/src/bootstrap/build/compile.rs b/src/bootstrap/build/compile.rs index 0a293579cf67d..95555aa379688 100644 --- a/src/bootstrap/build/compile.rs +++ b/src/bootstrap/build/compile.rs @@ -23,15 +23,13 @@ use build::{Build, Compiler, Mode}; /// This will build the standard library for a particular stage of the build /// using the `compiler` targeting the `target` architecture. The artifacts /// created will also be linked into the sysroot directory. -pub fn std<'a>(build: &'a Build, stage: u32, target: &str, - compiler: &Compiler<'a>) { - let host = compiler.host; - println!("Building stage{} std artifacts ({} -> {})", stage, - host, target); +pub fn std<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) { + println!("Building stage{} std artifacts ({} -> {})", compiler.stage, + compiler.host, target); // Move compiler-rt into place as it'll be required by the compiler when // building the standard library to link the dylib of libstd - let libdir = build.sysroot_libdir(stage, &host, target); + let libdir = build.sysroot_libdir(compiler, target); let _ = fs::remove_dir_all(&libdir); t!(fs::create_dir_all(&libdir)); t!(fs::hard_link(&build.compiler_rt_built.borrow()[target], @@ -39,10 +37,9 @@ pub fn std<'a>(build: &'a Build, stage: u32, target: &str, build_startup_objects(build, target, &libdir); - let out_dir = build.cargo_out(stage, &host, Mode::Libstd, target); + let out_dir = build.cargo_out(compiler, Mode::Libstd, target); build.clear_if_dirty(&out_dir, &build.compiler_path(compiler)); - let mut cargo = build.cargo(stage, compiler, Mode::Libstd, Some(target), - "build"); + let mut cargo = build.cargo(compiler, Mode::Libstd, target, "build"); cargo.arg("--features").arg(build.std_features()) .arg("--manifest-path") .arg(build.src.join("src/rustc/std_shim/Cargo.toml")); @@ -59,7 +56,7 @@ pub fn std<'a>(build: &'a Build, stage: u32, target: &str, } build.run(&mut cargo); - std_link(build, stage, target, compiler, host); + std_link(build, target, compiler, compiler.host); } /// Link all libstd rlibs/dylibs into the sysroot location. @@ -67,12 +64,12 @@ pub fn std<'a>(build: &'a Build, stage: u32, target: &str, /// Links those artifacts generated in the given `stage` for `target` produced /// by `compiler` into `host`'s sysroot. pub fn std_link(build: &Build, - stage: u32, target: &str, compiler: &Compiler, host: &str) { - let libdir = build.sysroot_libdir(stage, host, target); - let out_dir = build.cargo_out(stage, compiler.host, Mode::Libstd, target); + let target_compiler = Compiler::new(compiler.stage, host); + let libdir = build.sysroot_libdir(&target_compiler, target); + let out_dir = build.cargo_out(compiler, Mode::Libstd, target); // If we're linking one compiler host's output into another, then we weren't // called from the `std` method above. In that case we clean out what's @@ -85,7 +82,8 @@ pub fn std_link(build: &Build, } add_to_sysroot(&out_dir, &libdir); - if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) { + if target.contains("musl") && + (target.contains("x86_64") || target.contains("i686")) { copy_third_party_objects(build, target, &libdir); } } @@ -130,17 +128,14 @@ fn build_startup_objects(build: &Build, target: &str, into: &Path) { /// This will build the compiler for a particular stage of the build using /// the `compiler` targeting the `target` architecture. The artifacts /// created will also be linked into the sysroot directory. -pub fn rustc<'a>(build: &'a Build, stage: u32, target: &str, - compiler: &Compiler<'a>) { - let host = compiler.host; - println!("Building stage{} compiler artifacts ({} -> {})", stage, - host, target); +pub fn rustc<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) { + println!("Building stage{} compiler artifacts ({} -> {})", + compiler.stage, compiler.host, target); - let out_dir = build.cargo_out(stage, &host, Mode::Librustc, target); - build.clear_if_dirty(&out_dir, &libstd_shim(build, stage, &host, target)); + let out_dir = build.cargo_out(compiler, Mode::Librustc, target); + build.clear_if_dirty(&out_dir, &libstd_shim(build, compiler, target)); - let mut cargo = build.cargo(stage, compiler, Mode::Librustc, Some(target), - "build"); + let mut cargo = build.cargo(compiler, Mode::Librustc, target, "build"); cargo.arg("--features").arg(build.rustc_features()) .arg("--manifest-path") .arg(build.src.join("src/rustc/Cargo.toml")); @@ -184,7 +179,7 @@ pub fn rustc<'a>(build: &'a Build, stage: u32, target: &str, } build.run(&mut cargo); - rustc_link(build, stage, target, compiler, compiler.host); + rustc_link(build, target, compiler, compiler.host); } /// Link all librustc rlibs/dylibs into the sysroot location. @@ -192,19 +187,19 @@ pub fn rustc<'a>(build: &'a Build, stage: u32, target: &str, /// Links those artifacts generated in the given `stage` for `target` produced /// by `compiler` into `host`'s sysroot. pub fn rustc_link(build: &Build, - stage: u32, target: &str, compiler: &Compiler, host: &str) { - let libdir = build.sysroot_libdir(stage, host, target); - let out_dir = build.cargo_out(stage, compiler.host, Mode::Librustc, target); + let target_compiler = Compiler::new(compiler.stage, host); + let libdir = build.sysroot_libdir(&target_compiler, target); + let out_dir = build.cargo_out(compiler, Mode::Librustc, target); add_to_sysroot(&out_dir, &libdir); } /// Cargo's output path for the standard library in a given stage, compiled /// by a particular compiler for the specified target. -fn libstd_shim(build: &Build, stage: u32, host: &str, target: &str) -> PathBuf { - build.cargo_out(stage, host, Mode::Libstd, target).join("libstd_shim.rlib") +fn libstd_shim(build: &Build, compiler: &Compiler, target: &str) -> PathBuf { + build.cargo_out(compiler, Mode::Libstd, target).join("libstd_shim.rlib") } fn compiler_file(compiler: &Path, file: &str) -> String { @@ -219,16 +214,21 @@ fn compiler_file(compiler: &Path, file: &str) -> String { /// compiler. pub fn assemble_rustc(build: &Build, stage: u32, host: &str) { assert!(stage > 0, "the stage0 compiler isn't assembled, it's downloaded"); + // The compiler that we're assembling + let target_compiler = Compiler::new(stage, host); + + // The compiler that compiled the compiler we're assembling + let build_compiler = Compiler::new(stage - 1, &build.config.build); // Clear out old files - let sysroot = build.sysroot(stage, host); + let sysroot = build.sysroot(&target_compiler); let _ = fs::remove_dir_all(&sysroot); t!(fs::create_dir_all(&sysroot)); // Link in all dylibs to the libdir let sysroot_libdir = sysroot.join(libdir(host)); t!(fs::create_dir_all(&sysroot_libdir)); - let src_libdir = build.sysroot_libdir(stage - 1, &build.config.build, host); + let src_libdir = build.sysroot_libdir(&build_compiler, host); for f in t!(fs::read_dir(&src_libdir)).map(|f| t!(f)) { let filename = f.file_name().into_string().unwrap(); if is_dylib(&filename) { @@ -236,8 +236,7 @@ pub fn assemble_rustc(build: &Build, stage: u32, host: &str) { } } - let out_dir = build.cargo_out(stage - 1, &build.config.build, - Mode::Librustc, host); + let out_dir = build.cargo_out(&build_compiler, Mode::Librustc, host); // Link the compiler binary itself into place let rustc = out_dir.join(exe("rustc", host)); @@ -315,7 +314,7 @@ pub fn tool(build: &Build, stage: u32, host: &str, tool: &str) { // let out_dir = build.cargo_out(stage, &host, Mode::Librustc, target); // build.clear_if_dirty(&out_dir, &libstd_shim(build, stage, &host, target)); - let mut cargo = build.cargo(stage, &compiler, Mode::Tool, None, "build"); + let mut cargo = build.cargo(&compiler, Mode::Tool, host, "build"); cargo.arg("--manifest-path") .arg(build.src.join(format!("src/tools/{}/Cargo.toml", tool))); build.run(&mut cargo); diff --git a/src/bootstrap/build/doc.rs b/src/bootstrap/build/doc.rs index 84de48255413c..d8b02dce222cd 100644 --- a/src/bootstrap/build/doc.rs +++ b/src/bootstrap/build/doc.rs @@ -81,6 +81,7 @@ pub fn standalone(build: &Build, stage: u32, host: &str, out: &Path) { } let mut cmd = Command::new(&rustdoc); + build.add_rustc_lib_path(&compiler, &mut cmd); cmd.arg("--html-after-content").arg(&footer) .arg("--html-before-content").arg(&version_info) .arg("--html-in-header").arg(&favicon) @@ -107,14 +108,13 @@ pub fn standalone(build: &Build, stage: u32, host: &str, out: &Path) { pub fn std(build: &Build, stage: u32, host: &str, out: &Path) { println!("Documenting stage{} std ({})", stage, host); let compiler = Compiler::new(stage, host); - let out_dir = build.stage_out(stage, host, Mode::Libstd) + let out_dir = build.stage_out(&compiler, Mode::Libstd) .join(host).join("doc"); let rustdoc = build.rustdoc(&compiler); build.clear_if_dirty(&out_dir, &rustdoc); - let mut cargo = build.cargo(stage, &compiler, Mode::Libstd, Some(host), - "doc"); + let mut cargo = build.cargo(&compiler, Mode::Libstd, host, "doc"); cargo.arg("--manifest-path") .arg(build.src.join("src/rustc/std_shim/Cargo.toml")) .arg("--features").arg(build.std_features()); @@ -125,14 +125,13 @@ pub fn std(build: &Build, stage: u32, host: &str, out: &Path) { pub fn rustc(build: &Build, stage: u32, host: &str, out: &Path) { println!("Documenting stage{} compiler ({})", stage, host); let compiler = Compiler::new(stage, host); - let out_dir = build.stage_out(stage, host, Mode::Librustc) + let out_dir = build.stage_out(&compiler, Mode::Librustc) .join(host).join("doc"); let rustdoc = build.rustdoc(&compiler); if !up_to_date(&rustdoc, &out_dir.join("rustc/index.html")) { t!(fs::remove_dir_all(&out_dir)); } - let mut cargo = build.cargo(stage, &compiler, Mode::Librustc, Some(host), - "doc"); + let mut cargo = build.cargo(&compiler, Mode::Librustc, host, "doc"); cargo.arg("--manifest-path") .arg(build.src.join("src/rustc/Cargo.toml")) .arg("--features").arg(build.rustc_features()); diff --git a/src/bootstrap/build/mod.rs b/src/bootstrap/build/mod.rs index 058f27c33f607..39bd74c78ff2a 100644 --- a/src/bootstrap/build/mod.rs +++ b/src/bootstrap/build/mod.rs @@ -152,19 +152,17 @@ impl Build { CompilerRt { _dummy } => { native::compiler_rt(self, target.target); } - Libstd { stage, compiler } => { - compile::std(self, stage, target.target, &compiler); + Libstd { compiler } => { + compile::std(self, target.target, &compiler); } - Librustc { stage, compiler } => { - compile::rustc(self, stage, target.target, &compiler); + Librustc { compiler } => { + compile::rustc(self, target.target, &compiler); } - LibstdLink { stage, compiler, host } => { - compile::std_link(self, stage, target.target, - &compiler, host); + LibstdLink { compiler, host } => { + compile::std_link(self, target.target, &compiler, host); } - LibrustcLink { stage, compiler, host } => { - compile::rustc_link(self, stage, target.target, - &compiler, host); + LibrustcLink { compiler, host } => { + compile::rustc_link(self, target.target, &compiler, host); } Rustc { stage: 0 } => { // nothing to do... @@ -261,58 +259,52 @@ impl Build { /// This will create a `Command` that represents a pending execution of /// Cargo for the specified stage, whether or not the standard library is /// being built, and using the specified compiler targeting `target`. - // FIXME: aren't stage/compiler duplicated? fn cargo(&self, - stage: u32, compiler: &Compiler, mode: Mode, - target: Option<&str>, + target: &str, cmd: &str) -> Command { let mut cargo = Command::new(&self.cargo); - let host = compiler.host; - let out_dir = self.stage_out(stage, host, mode); + let out_dir = self.stage_out(compiler, mode); cargo.env("CARGO_TARGET_DIR", out_dir) .arg(cmd) - .arg("-j").arg(self.jobs().to_string()); + .arg("-j").arg(self.jobs().to_string()) + .arg("--target").arg(target); // Customize the compiler we're running. Specify the compiler to cargo // as our shim and then pass it some various options used to configure // how the actual compiler itself is called. cargo.env("RUSTC", self.out.join("bootstrap/debug/rustc")) .env("RUSTC_REAL", self.compiler_path(compiler)) - .env("RUSTC_STAGE", self.stage_arg(stage, compiler).to_string()) + .env("RUSTC_STAGE", compiler.stage.to_string()) .env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string()) .env("RUSTC_CODEGEN_UNITS", self.config.rust_codegen_units.to_string()) .env("RUSTC_DEBUG_ASSERTIONS", self.config.rust_debug_assertions.to_string()) .env("RUSTC_SNAPSHOT", &self.rustc) - .env("RUSTC_SYSROOT", self.sysroot(stage, host)) + .env("RUSTC_SYSROOT", self.sysroot(compiler)) .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir()) .env("RUSTC_RPATH", self.config.rust_rpath.to_string()) .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc")) - .env("RUSTDOC_REAL", self.rustdoc(compiler)); - - if let Some(target) = target { - cargo.env("RUSTC_FLAGS", self.rustc_flags(target).join(" ")); - cargo.arg("--target").arg(target); - - // Specify some various options for build scripts used throughout - // the build. - // - // FIXME: the guard against msvc shouldn't need to be here - if !target.contains("msvc") { - cargo.env(format!("CC_{}", target), self.cc(target)) - .env(format!("AR_{}", target), self.ar(target)) - .env(format!("CFLAGS_{}", target), self.cflags(target)); - } - - // Environment variables *required* needed throughout the build - // - // FIXME: should update code to not require this env vars - cargo.env("CFG_COMPILER_HOST_TRIPLE", target); + .env("RUSTDOC_REAL", self.rustdoc(compiler)) + .env("RUSTC_FLAGS", self.rustc_flags(target).join(" ")); + + // Specify some various options for build scripts used throughout + // the build. + // + // FIXME: the guard against msvc shouldn't need to be here + if !target.contains("msvc") { + cargo.env(format!("CC_{}", target), self.cc(target)) + .env(format!("AR_{}", target), self.ar(target)) + .env(format!("CFLAGS_{}", target), self.cflags(target)); } + // Environment variables *required* needed throughout the build + // + // FIXME: should update code to not require this env vars + cargo.env("CFG_COMPILER_HOST_TRIPLE", target); + if self.config.verbose || self.flags.verbose { cargo.arg("-v"); } @@ -328,50 +320,37 @@ impl Build { if compiler.is_snapshot(self) { self.rustc.clone() } else { - self.sysroot(compiler.stage, compiler.host).join("bin") - .join(exe("rustc", compiler.host)) + self.sysroot(compiler).join("bin").join(exe("rustc", compiler.host)) } } /// Get the specified tool built by the specified compiler fn tool(&self, compiler: &Compiler, tool: &str) -> PathBuf { - self.stage_out(compiler.stage, compiler.host, Mode::Tool) - .join(self.cargo_dir()) + self.cargo_out(compiler, Mode::Tool, compiler.host) .join(exe(tool, compiler.host)) } /// Get the `rustdoc` executable next to the specified compiler fn rustdoc(&self, compiler: &Compiler) -> PathBuf { - let root = if compiler.is_snapshot(self) { - let mut rustdoc = self.rustc.clone(); - rustdoc.pop(); - rustdoc - } else { - let (stage, host) = (compiler.stage, compiler.host); - self.cargo_out(stage - 1, host, Mode::Librustc, host) - }; - root.join(exe("rustdoc", compiler.host)) + let mut rustdoc = self.compiler_path(compiler); + rustdoc.pop(); + rustdoc.push(exe("rustdoc", compiler.host)); + return rustdoc } /// Get a `Command` which is ready to run `tool` in `stage` built for /// `host`. - #[allow(dead_code)] // this will be used soon fn tool_cmd(&self, compiler: &Compiler, tool: &str) -> Command { let mut cmd = Command::new(self.tool(&compiler, tool)); let host = compiler.host; - let stage = compiler.stage; let paths = vec![ - self.cargo_out(stage, host, Mode::Libstd, host).join("deps"), - self.cargo_out(stage, host, Mode::Librustc, host).join("deps"), + self.cargo_out(compiler, Mode::Libstd, host).join("deps"), + self.cargo_out(compiler, Mode::Librustc, host).join("deps"), ]; add_lib_path(paths, &mut cmd); return cmd } - fn stage_arg(&self, stage: u32, compiler: &Compiler) -> u32 { - if stage == 0 && compiler.host != self.config.build {1} else {stage} - } - /// Get the space-separated set of activated features for the standard /// library. fn std_features(&self) -> String { @@ -400,16 +379,16 @@ impl Build { if self.config.rust_optimize {"release"} else {"debug"} } - fn sysroot(&self, stage: u32, host: &str) -> PathBuf { - if stage == 0 { - self.stage_out(stage, host, Mode::Librustc) + fn sysroot(&self, compiler: &Compiler) -> PathBuf { + if compiler.stage == 0 { + self.out.join(compiler.host).join("stage0-sysroot") } else { - self.out.join(host).join(format!("stage{}", stage)) + self.out.join(compiler.host).join(format!("stage{}", compiler.stage)) } } - fn sysroot_libdir(&self, stage: u32, host: &str, target: &str) -> PathBuf { - self.sysroot(stage, host).join("lib").join("rustlib") + fn sysroot_libdir(&self, compiler: &Compiler, target: &str) -> PathBuf { + self.sysroot(compiler).join("lib").join("rustlib") .join(target).join("lib") } @@ -417,20 +396,23 @@ impl Build { /// stage when running with a particular host compiler. /// /// The mode indicates what the root directory is for. - fn stage_out(&self, stage: u32, host: &str, mode: Mode) -> PathBuf { + fn stage_out(&self, compiler: &Compiler, mode: Mode) -> PathBuf { let suffix = match mode { Mode::Libstd => "-std", _ => "-rustc", }; - self.out.join(host).join(format!("stage{}{}", stage, suffix)) + self.out.join(compiler.host) + .join(format!("stage{}{}", compiler.stage, suffix)) } /// Returns the root output directory for all Cargo output in a given stage, /// running a particular comipler, wehther or not we're building the /// standard library, and targeting the specified architecture. - fn cargo_out(&self, stage: u32, host: &str, mode: Mode, + fn cargo_out(&self, + compiler: &Compiler, + mode: Mode, target: &str) -> PathBuf { - self.stage_out(stage, host, mode).join(target).join(self.cargo_dir()) + self.stage_out(compiler, mode).join(target).join(self.cargo_dir()) } /// Root output directory for LLVM compiled for `target` @@ -456,8 +438,7 @@ impl Build { if compiler.is_snapshot(self) { self.rustc_snapshot_libdir() } else { - self.sysroot(compiler.stage, compiler.host) - .join(libdir(compiler.host)) + self.sysroot(compiler).join(libdir(compiler.host)) } } diff --git a/src/bootstrap/build/step.rs b/src/bootstrap/build/step.rs index 720ba4fd2094d..dfac074e3cd75 100644 --- a/src/bootstrap/build/step.rs +++ b/src/bootstrap/build/step.rs @@ -29,18 +29,16 @@ macro_rules! targets { // and one for the compiler itself. These are parameterized over the // stage output they're going to be placed in along with the // compiler which is producing the copy of libstd or librustc - (libstd, Libstd { stage: u32, compiler: Compiler<'a> }), - (librustc, Librustc { stage: u32, compiler: Compiler<'a> }), + (libstd, Libstd { compiler: Compiler<'a> }), + (librustc, Librustc { compiler: Compiler<'a> }), // Links the standard library/librustc produced by the compiler // provided into the host's directory also provided. (libstd_link, LibstdLink { - stage: u32, compiler: Compiler<'a>, host: &'a str }), (librustc_link, LibrustcLink { - stage: u32, compiler: Compiler<'a>, host: &'a str }), @@ -144,10 +142,9 @@ fn top_level(build: &Build) -> Vec { } let host = t.target(host); if host.target == build.config.build { - targets.push(host.librustc(stage, host.compiler(stage))); + targets.push(host.librustc(host.compiler(stage))); } else { - targets.push(host.librustc_link(stage, t.compiler(stage), - host.target)); + targets.push(host.librustc_link(t.compiler(stage), host.target)); } for target in build.config.target.iter() { if !build.flags.target.contains(target) { @@ -156,11 +153,10 @@ fn top_level(build: &Build) -> Vec { if host.target == build.config.build { targets.push(host.target(target) - .libstd(stage, host.compiler(stage))); + .libstd(host.compiler(stage))); } else { targets.push(host.target(target) - .libstd_link(stage, t.compiler(stage), - host.target)); + .libstd_link(t.compiler(stage), host.target)); } } } @@ -238,29 +234,29 @@ impl<'a> Step<'a> { } Source::Rustc { stage } => { let compiler = Compiler::new(stage - 1, &build.config.build); - vec![self.librustc(stage - 1, compiler)] + vec![self.librustc(compiler)] } - Source::Librustc { stage, compiler } => { - vec![self.libstd(stage, compiler), self.llvm(())] + Source::Librustc { compiler } => { + vec![self.libstd(compiler), self.llvm(())] } - Source::Libstd { stage: _, compiler } => { + Source::Libstd { compiler } => { vec![self.compiler_rt(()), self.rustc(compiler.stage).target(compiler.host)] } - Source::LibrustcLink { stage, compiler, host } => { - vec![self.librustc(stage, compiler), - self.libstd_link(stage, compiler, host)] + Source::LibrustcLink { compiler, host } => { + vec![self.librustc(compiler), + self.libstd_link(compiler, host)] } - Source::LibstdLink { stage, compiler, host } => { - vec![self.libstd(stage, compiler), - self.target(host).rustc(stage)] + Source::LibstdLink { compiler, host } => { + vec![self.libstd(compiler), + self.target(host).rustc(compiler.stage)] } Source::CompilerRt { _dummy } => { vec![self.llvm(()).target(&build.config.build)] } Source::Llvm { _dummy } => Vec::new(), Source::DocStd { stage } => { - vec![self.libstd(stage, self.compiler(stage))] + vec![self.libstd(self.compiler(stage))] } Source::DocBook { stage } | Source::DocNomicon { stage } | @@ -290,11 +286,11 @@ impl<'a> Step<'a> { } Source::ToolLinkchecker { stage } => { - vec![self.libstd(stage, self.compiler(stage))] + vec![self.libstd(self.compiler(stage))] } Source::ToolErrorIndex { stage } | Source::ToolRustbook { stage } => { - vec![self.librustc(stage, self.compiler(stage))] + vec![self.librustc(self.compiler(stage))] } } } diff --git a/src/nightlies.txt b/src/nightlies.txt index 59e2fce6f0938..778380d935c8d 100644 --- a/src/nightlies.txt +++ b/src/nightlies.txt @@ -1,2 +1,2 @@ rustc: 2016-02-17 -cargo: 2016-01-21 +cargo: 2016-03-11 diff --git a/src/rustc/Cargo.lock b/src/rustc/Cargo.lock index a271835164043..0e7537a9cbd04 100644 --- a/src/rustc/Cargo.lock +++ b/src/rustc/Cargo.lock @@ -349,7 +349,6 @@ name = "test" version = "0.0.0" dependencies = [ "getopts 0.0.0", - "serialize 0.0.0", "term 0.0.0", ] From 158b854fb73dab7680f9554c2bbde2f821d2630e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 11 Mar 2016 18:27:32 -0800 Subject: [PATCH 4/4] linkchecker: Fix path checks on Windows --- src/tools/linkchecker/main.rs | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index e5e88081bc43e..19037a2c4d7f2 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -76,29 +76,28 @@ fn check(root: &Path, file: &Path, base: &Url, errors: &mut bool) { // Unfortunately we're not 100% full of valid links today to we need a few // whitelists to get this past `make check` today. - if let Some(path) = pretty_file.to_str() { - // FIXME(#32129) - if path == "std/string/struct.String.html" { - return - } - // FIXME(#32130) - if path.contains("btree_set/struct.BTreeSet.html") || - path == "collections/struct.BTreeSet.html" { - return - } - // FIXME(#31948) - if path.contains("ParseFloatError") { - return - } + // FIXME(#32129) + if file.ends_with("std/string/struct.String.html") { + return + } + // FIXME(#32130) + if file.ends_with("btree_set/struct.BTreeSet.html") || + file.ends_with("collections/struct.BTreeSet.html") { + return + } + + if file.ends_with("std/sys/ext/index.html") { + return + } - // currently - if path == "std/sys/ext/index.html" { + if let Some(file) = file.to_str() { + // FIXME(#31948) + if file.contains("ParseFloatError") { return } - // weird reexports, but this module is on its way out, so chalk it up to // "rustdoc weirdness" and move on from there - if path.contains("scoped_tls") { + if file.contains("scoped_tls") { return } }