Skip to content

Rollup of 7 pull requests #43047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5a97036
Convert Intos to Froms.
May 20, 2017
0d885ef
Update version numbers for From impls
ollie27 Jun 12, 2017
34ddc51
Don't allocate args in order to run find.
Mark-Simulacrum Jun 21, 2017
e1ce766
Clean up and restructure sanity checking.
Mark-Simulacrum Jun 21, 2017
f9957be
Remove 'static lifetimes from channels.
Mark-Simulacrum Jun 24, 2017
8b2e7d2
Cleanups to check code.
Mark-Simulacrum Jun 26, 2017
8394408
Cleanup compile.rs.
Mark-Simulacrum Jun 27, 2017
a40af83
Cleanup utils
Mark-Simulacrum Jun 27, 2017
24ea7ba
Cleanup dist
Mark-Simulacrum Jun 27, 2017
5751fea
Clippy lints
Mark-Simulacrum Jun 27, 2017
01d22a1
Update a few comments.
Mark-Simulacrum Jun 27, 2017
785e5c7
Clarify meaning of Build.cargo, Build.rustc.
Mark-Simulacrum Jun 27, 2017
2df56a6
Remove src_is_git, instead call method on rust_info directly.
Mark-Simulacrum Jun 27, 2017
1561b0c
Store positive instead of negative fail_fast.
Mark-Simulacrum Jun 27, 2017
5cfe2a8
Store verbosity on Build
Mark-Simulacrum Jun 27, 2017
ff796e7
Move targets, hosts, and build triple into Build.
Mark-Simulacrum Jun 27, 2017
e04754b
Use build.build instead of build.config.build
Mark-Simulacrum Jun 27, 2017
8ee6bdd
redox: symlink and readlink
ids1024 Jun 30, 2017
affe6e1
Ignore *.iml files
stepancheg Jun 30, 2017
3456608
Fix long line
ids1024 Jun 30, 2017
d68c3ab
Document unintuitive argument order for Vec::dedup_by relation
andersk Jul 3, 2017
dcd7c5f
Add a stability marker for core::cmp::Reverse.0
sfackler Jul 3, 2017
857d9db
README: note how to enable debugging for rustc
PlasmaPower Jul 4, 2017
0f8998d
Rollup merge of #42227 - ollie27:into_to_from, r=aturon
Mark-Simulacrum Jul 4, 2017
411188b
Rollup merge of #42975 - ids1024:symlink2, r=aturon
Mark-Simulacrum Jul 4, 2017
c868b24
Rollup merge of #42994 - stepancheg:ignore-iml, r=aturon
Mark-Simulacrum Jul 4, 2017
2b7cd5a
Rollup merge of #43041 - andersk:dedup_by, r=alexcrichton
Mark-Simulacrum Jul 4, 2017
1d0c2e9
Rollup merge of #43042 - Mark-Simulacrum:rustbuild-cleanup, r=alexcri…
Mark-Simulacrum Jul 4, 2017
5b86b35
Rollup merge of #43043 - sfackler:reverse-stability, r=Mark-Simulacrum
Mark-Simulacrum Jul 4, 2017
396d36c
Rollup merge of #43045 - PlasmaPower:patch-1, r=Mark-Simulacrum
Mark-Simulacrum Jul 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
.hg/
.hgignore
.idea
*.iml
__pycache__/
*.py[cod]
*$py.class
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ Read ["Installation"] from [The Book].

> ***Note:*** Install locations can be adjusted by copying the config file
> from `./src/bootstrap/config.toml.example` to `./config.toml`, and
> adjusting the `prefix` option under `[install]`. Various other options are
> also supported, and are documented in the config file.
> adjusting the `prefix` option under `[install]`. Various other options, such
> as enabling debug information, are also supported, and are documented in
> the config file.

When complete, `sudo ./x.py install` will place several programs into
`/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
Expand Down
15 changes: 5 additions & 10 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,11 @@ fn main() {
Err(_) => 0,
};

// Build scripts always use the snapshot compiler which is guaranteed to be
// able to produce an executable, whereas intermediate compilers may not
// have the standard library built yet and may not be able to produce an
// executable. Otherwise we just use the standard compiler we're
// bootstrapping with.
//
// Also note that cargo will detect the version of the compiler to trigger
// a rebuild when the compiler changes. If this happens, we want to make
// sure to use the actual compiler instead of the snapshot compiler becase
// that's the one that's actually changing.
// Use a different compiler for build scripts, since there may not yet be a
// libstd for the real compiler to use. However, if Cargo is attempting to
// determine the version of the compiler, the real compiler needs to be
// used. Currently, these two states are differentiated based on whether
// --target and -vV is/isn't passed.
let (rustc, libdir) = if target.is_none() && version.is_none() {
("RUSTC_SNAPSHOT", "RUSTC_SNAPSHOT_LIBDIR")
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/cc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ use config::Target;
pub fn find(build: &mut Build) {
// For all targets we're going to need a C compiler for building some shims
// and such as well as for being a linker for Rust code.
for target in build.config.target.iter() {
for target in &build.targets {
let mut cfg = gcc::Config::new();
cfg.cargo_metadata(false).opt_level(0).debug(false)
.target(target).host(&build.config.build);
.target(target).host(&build.build);

let config = build.config.target_config.get(target);
if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
Expand All @@ -64,10 +64,10 @@ pub fn find(build: &mut Build) {
}

// For all host triples we need to find a C++ compiler as well
for host in build.config.host.iter() {
for host in &build.hosts {
let mut cfg = gcc::Config::new();
cfg.cargo_metadata(false).opt_level(0).debug(false).cpp(true)
.target(host).host(&build.config.build);
.target(host).host(&build.build);
let config = build.config.target_config.get(host);
if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
cfg.compiler(cxx);
Expand Down
10 changes: 7 additions & 3 deletions src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ use build_helper::output;
use Build;

// The version number
pub const CFG_RELEASE_NUM: &'static str = "1.20.0";
pub const CFG_RELEASE_NUM: &str = "1.20.0";

// An optional number to put after the label, e.g. '.2' -> '-beta.2'
// Be sure to make this starts with a dot to conform to semver pre-release
// versions (section 9)
pub const CFG_PRERELEASE_VERSION: &'static str = ".1";
pub const CFG_PRERELEASE_VERSION: &str = ".1";

pub struct GitInfo {
inner: Option<Info>,
Expand Down Expand Up @@ -99,6 +99,10 @@ impl GitInfo {
version.push_str(&inner.commit_date);
version.push_str(")");
}
return version
version
}

pub fn is_git(&self) -> bool {
self.inner.is_some()
}
}
77 changes: 36 additions & 41 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@
//! This file implements the various regression test suites that we execute on
//! our CI.

extern crate build_helper;

use std::collections::HashSet;
use std::env;
use std::iter;
use std::fmt;
use std::fs::{self, File};
use std::path::{PathBuf, Path};
use std::process::Command;
use std::io::Read;

use build_helper::output;
use build_helper::{self, output};

use {Build, Compiler, Mode};
use dist;
use util::{self, dylib_path, dylib_path_var, exe};

const ADB_TEST_DIR: &'static str = "/data/tmp/work";
const ADB_TEST_DIR: &str = "/data/tmp/work";

/// The two modes of the test runner; tests or benchmarks.
#[derive(Copy, Clone)]
Expand Down Expand Up @@ -60,7 +59,7 @@ impl fmt::Display for TestKind {
}

fn try_run(build: &Build, cmd: &mut Command) {
if build.flags.cmd.no_fail_fast() {
if !build.fail_fast {
if !build.try_run(cmd) {
let failures = build.delayed_failures.get();
build.delayed_failures.set(failures + 1);
Expand All @@ -71,7 +70,7 @@ fn try_run(build: &Build, cmd: &mut Command) {
}

fn try_run_quiet(build: &Build, cmd: &mut Command) {
if build.flags.cmd.no_fail_fast() {
if !build.fail_fast {
if !build.try_run_quiet(cmd) {
let failures = build.delayed_failures.get();
build.delayed_failures.set(failures + 1);
Expand Down Expand Up @@ -99,7 +98,7 @@ pub fn linkcheck(build: &Build, host: &str) {
/// This tool in `src/tools` will check out a few Rust projects and run `cargo
/// test` to ensure that we don't regress the test suites there.
pub fn cargotest(build: &Build, stage: u32, host: &str) {
let ref compiler = Compiler::new(stage, host);
let compiler = Compiler::new(stage, host);

// Note that this is a short, cryptic, and not scoped directory name. This
// is currently to minimize the length of path on Windows where we otherwise
Expand All @@ -109,11 +108,11 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {

let _time = util::timeit();
let mut cmd = Command::new(build.tool(&Compiler::new(0, host), "cargotest"));
build.prepare_tool_cmd(compiler, &mut cmd);
try_run(build, cmd.arg(&build.cargo)
build.prepare_tool_cmd(&compiler, &mut cmd);
try_run(build, cmd.arg(&build.initial_cargo)
.arg(&out_dir)
.env("RUSTC", build.compiler_path(compiler))
.env("RUSTDOC", build.rustdoc(compiler)));
.env("RUSTC", build.compiler_path(&compiler))
.env("RUSTDOC", build.rustdoc(&compiler)));
}

/// Runs `cargo test` for `cargo` packaged with Rust.
Expand All @@ -124,13 +123,12 @@ pub fn cargo(build: &Build, stage: u32, host: &str) {
// and not RUSTC because the Cargo test suite has tests that will
// fail if rustc is not spelled `rustc`.
let path = build.sysroot(compiler).join("bin");
let old_path = ::std::env::var("PATH").expect("");
let sep = if cfg!(windows) { ";" } else {":" };
let ref newpath = format!("{}{}{}", path.display(), sep, old_path);
let old_path = env::var_os("PATH").unwrap_or_default();
let newpath = env::join_paths(iter::once(path).chain(env::split_paths(&old_path))).expect("");

let mut cargo = build.cargo(compiler, Mode::Tool, host, "test");
cargo.arg("--manifest-path").arg(build.src.join("src/tools/cargo/Cargo.toml"));
if build.flags.cmd.no_fail_fast() {
if !build.fail_fast {
cargo.arg("--no-fail-fast");
}

Expand Down Expand Up @@ -198,9 +196,9 @@ pub fn compiletest(build: &Build,
cmd.arg("--mode").arg(mode);
cmd.arg("--target").arg(target);
cmd.arg("--host").arg(compiler.host);
cmd.arg("--llvm-filecheck").arg(build.llvm_filecheck(&build.config.build));
cmd.arg("--llvm-filecheck").arg(build.llvm_filecheck(&build.build));

if let Some(nodejs) = build.config.nodejs.as_ref() {
if let Some(ref nodejs) = build.config.nodejs {
cmd.arg("--nodejs").arg(nodejs);
}

Expand All @@ -224,7 +222,7 @@ pub fn compiletest(build: &Build,

cmd.arg("--docck-python").arg(build.python());

if build.config.build.ends_with("apple-darwin") {
if build.build.ends_with("apple-darwin") {
// Force /usr/bin/python on macOS for LLDB tests because we're loading the
// LLDB plugin's compiled module which only works with the system python
// (namely not Homebrew-installed python)
Expand All @@ -251,7 +249,7 @@ pub fn compiletest(build: &Build,

cmd.args(&build.flags.cmd.test_args());

if build.config.verbose() || build.flags.verbose() {
if build.is_verbose() {
cmd.arg("--verbose");
}

Expand Down Expand Up @@ -279,7 +277,7 @@ pub fn compiletest(build: &Build,

if build.remote_tested(target) {
cmd.arg("--remote-test-client")
.arg(build.tool(&Compiler::new(0, &build.config.build),
.arg(build.tool(&Compiler::new(0, &build.build),
"remote-test-client"));
}

Expand Down Expand Up @@ -368,7 +366,7 @@ pub fn error_index(build: &Build, compiler: &Compiler) {
"error_index_generator")
.arg("markdown")
.arg(&output)
.env("CFG_BUILD", &build.config.build));
.env("CFG_BUILD", &build.build));

markdown_test(build, compiler, &output);
}
Expand Down Expand Up @@ -450,7 +448,7 @@ pub fn krate(build: &Build,
cargo.arg("--manifest-path")
.arg(build.src.join(path).join("Cargo.toml"))
.arg("--features").arg(features);
if test_kind.subcommand() == "test" && build.flags.cmd.no_fail_fast() {
if test_kind.subcommand() == "test" && !build.fail_fast {
cargo.arg("--no-fail-fast");
}

Expand Down Expand Up @@ -520,16 +518,14 @@ fn krate_emscripten(build: &Build,
compiler: &Compiler,
target: &str,
mode: Mode) {
let mut tests = Vec::new();
let out_dir = build.cargo_out(compiler, mode, target);
find_tests(&out_dir.join("deps"), target, &mut tests);
let tests = find_tests(&out_dir.join("deps"), target);

let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured");
for test in tests {
let test_file_name = test.to_string_lossy().into_owned();
println!("running {}", test_file_name);
let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured");
println!("running {}", test.display());
let mut cmd = Command::new(nodejs);
cmd.arg(&test_file_name);
cmd.arg(&test);
if build.config.quiet_tests {
cmd.arg("--quiet");
}
Expand All @@ -541,11 +537,10 @@ fn krate_remote(build: &Build,
compiler: &Compiler,
target: &str,
mode: Mode) {
let mut tests = Vec::new();
let out_dir = build.cargo_out(compiler, mode, target);
find_tests(&out_dir.join("deps"), target, &mut tests);
let tests = find_tests(&out_dir.join("deps"), target);

let tool = build.tool(&Compiler::new(0, &build.config.build),
let tool = build.tool(&Compiler::new(0, &build.build),
"remote-test-client");
for test in tests {
let mut cmd = Command::new(&tool);
Expand All @@ -559,9 +554,8 @@ fn krate_remote(build: &Build,
}
}

fn find_tests(dir: &Path,
target: &str,
dst: &mut Vec<PathBuf>) {
fn find_tests(dir: &Path, target: &str) -> Vec<PathBuf> {
let mut dst = Vec::new();
for e in t!(dir.read_dir()).map(|e| t!(e)) {
let file_type = t!(e.file_type());
if !file_type.is_file() {
Expand All @@ -576,6 +570,7 @@ fn find_tests(dir: &Path,
dst.push(e.path());
}
}
dst
}

pub fn remote_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
Expand All @@ -590,7 +585,7 @@ pub fn remote_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
.join(exe("remote-test-server", target));

// Spawn the emulator and wait for it to come online
let tool = build.tool(&Compiler::new(0, &build.config.build),
let tool = build.tool(&Compiler::new(0, &build.build),
"remote-test-client");
let mut cmd = Command::new(&tool);
cmd.arg("spawn-emulator")
Expand All @@ -616,7 +611,7 @@ pub fn remote_copy_libs(build: &Build, compiler: &Compiler, target: &str) {

/// Run "distcheck", a 'make check' from a tarball
pub fn distcheck(build: &Build) {
if build.config.build != "x86_64-unknown-linux-gnu" {
if build.build != "x86_64-unknown-linux-gnu" {
return
}
if !build.config.host.iter().any(|s| s == "x86_64-unknown-linux-gnu") {
Expand All @@ -641,7 +636,7 @@ pub fn distcheck(build: &Build) {
.args(&build.config.configure_args)
.arg("--enable-vendor")
.current_dir(&dir));
build.run(Command::new(build_helper::make(&build.config.build))
build.run(Command::new(build_helper::make(&build.build))
.arg("check")
.current_dir(&dir));

Expand All @@ -659,7 +654,7 @@ pub fn distcheck(build: &Build) {
build.run(&mut cmd);

let toml = dir.join("rust-src/lib/rustlib/src/rust/src/libstd/Cargo.toml");
build.run(Command::new(&build.cargo)
build.run(Command::new(&build.initial_cargo)
.arg("generate-lockfile")
.arg("--manifest-path")
.arg(&toml)
Expand All @@ -668,13 +663,13 @@ pub fn distcheck(build: &Build) {

/// Test the build system itself
pub fn bootstrap(build: &Build) {
let mut cmd = Command::new(&build.cargo);
let mut cmd = Command::new(&build.initial_cargo);
cmd.arg("test")
.current_dir(build.src.join("src/bootstrap"))
.env("CARGO_TARGET_DIR", build.out.join("bootstrap"))
.env("RUSTC_BOOTSTRAP", "1")
.env("RUSTC", &build.rustc);
if build.flags.cmd.no_fail_fast() {
.env("RUSTC", &build.initial_rustc);
if !build.fail_fast {
cmd.arg("--no-fail-fast");
}
cmd.arg("--").args(&build.flags.cmd.test_args());
Expand Down
Loading