diff options
| author | bors <bors@rust-lang.org> | 2017-06-22 12:48:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-06-22 12:48:54 +0000 |
| commit | 74fa27928aceda1362a2266d9b9bf129999bc00a (patch) | |
| tree | f6885a656b791f657e5ea561d732c91414a9621a /src | |
| parent | 6f01c84fc8ae1b07d8165ceccb2e432f45a2ff1a (diff) | |
| parent | 7f693e2cb9455fcfbe4de69236abc6a0ef98624b (diff) | |
| download | rust-74fa27928aceda1362a2266d9b9bf129999bc00a.tar.gz rust-74fa27928aceda1362a2266d9b9bf129999bc00a.zip | |
Auto merge of #42824 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 4 pull requests - Successful merges: #42799, #42804, #42805, #42806 - Failed merges:
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/bin/rustc.rs | 9 | ||||
| -rw-r--r-- | src/bootstrap/bin/rustdoc.rs | 10 | ||||
| -rw-r--r-- | src/bootstrap/bootstrap.py | 1 | ||||
| -rw-r--r-- | src/bootstrap/compile.rs | 32 | ||||
| -rw-r--r-- | src/bootstrap/sanity.rs | 7 | ||||
| -rw-r--r-- | src/librustdoc/core.rs | 7 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 6 | ||||
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 2 |
8 files changed, 66 insertions, 8 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 12152fc4399..8c6eaee24f2 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -236,6 +236,15 @@ fn main() { } } + let color = match env::var("RUSTC_COLOR") { + Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"), + Err(_) => 0, + }; + + if color != 0 { + cmd.arg("--color=always"); + } + if verbose > 1 { writeln!(&mut io::stderr(), "rustc command: {:?}", cmd).unwrap(); } diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index 3a1a9c3e40d..d7d72d5dd56 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -41,11 +41,11 @@ fn main() { .env(bootstrap::util::dylib_path_var(), env::join_paths(&dylib_path).unwrap()); - // Pass the `rustbuild` feature flag to crates which rustbuild is - // building. See the comment in bootstrap/lib.rs where this env var is - // set for more details. - if env::var_os("RUSTBUILD_UNSTABLE").is_some() { - cmd.arg("--cfg").arg("rustbuild"); + // Force all crates compiled by this compiler to (a) be unstable and (b) + // allow the `rustc_private` feature to link to other unstable crates + // also in the sysroot. + if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() { + cmd.arg("-Z").arg("force-unstable-if-unmarked"); } std::process::exit(match cmd.status() { diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 1d3b77916d6..8dc2875ec42 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -668,6 +668,7 @@ def bootstrap(): env["BUILD"] = rb.build env["SRC"] = rb.rust_root env["BOOTSTRAP_PARENT_ID"] = str(os.getpid()) + env["BOOTSTRAP_PYTHON"] = sys.executable run(args, env=env, verbose=rb.verbose) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 9a07e8a8b10..f92a199fa3f 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -477,11 +477,43 @@ pub fn tool(build: &Build, stage: u32, target: &str, tool: &str) { build.run(&mut cargo); } + +// Avoiding a dependency on winapi to keep compile times down +#[cfg(unix)] +fn stderr_isatty() -> bool { + use libc; + unsafe { libc::isatty(libc::STDERR_FILENO) != 0 } +} +#[cfg(windows)] +fn stderr_isatty() -> bool { + type DWORD = u32; + type BOOL = i32; + type HANDLE = *mut u8; + const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD; + extern "system" { + fn GetStdHandle(which: DWORD) -> HANDLE; + fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: *mut DWORD) -> BOOL; + } + unsafe { + let handle = GetStdHandle(STD_ERROR_HANDLE); + let mut out = 0; + GetConsoleMode(handle, &mut out) != 0 + } +} + fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) { // Instruct Cargo to give us json messages on stdout, critically leaving // stderr as piped so we can get those pretty colors. cargo.arg("--message-format").arg("json") .stdout(Stdio::piped()); + + if stderr_isatty() { + // since we pass message-format=json to cargo, we need to tell the rustc + // wrapper to give us colored output if necessary. This is because we + // only want Cargo's JSON output, not rustcs. + cargo.env("RUSTC_COLOR", "1"); + } + build.verbose(&format!("running: {:?}", cargo)); let mut child = match cargo.spawn() { Ok(child) => child, diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index df6378a970b..5ccd131b77a 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -23,6 +23,7 @@ use std::env; use std::ffi::{OsStr, OsString}; use std::fs; use std::process::Command; +use std::path::PathBuf; use build_helper::output; @@ -87,6 +88,12 @@ pub fn check(build: &mut Build) { } if build.config.python.is_none() { + // set by bootstrap.py + if let Some(v) = env::var_os("BOOTSTRAP_PYTHON") { + build.config.python = Some(PathBuf::from(v)); + } + } + if build.config.python.is_none() { build.config.python = have_cmd("python2.7".as_ref()); } if build.config.python.is_none() { diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 9a689ed079e..62b91feb09d 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -106,7 +106,8 @@ pub fn run_core(search_paths: SearchPaths, input: Input, triple: Option<String>, maybe_sysroot: Option<PathBuf>, - allow_warnings: bool) -> (clean::Crate, RenderInfo) + allow_warnings: bool, + force_unstable_if_unmarked: bool) -> (clean::Crate, RenderInfo) { // Parse, resolve, and typecheck the given crate. @@ -128,6 +129,10 @@ pub fn run_core(search_paths: SearchPaths, // Ensure that rustdoc works even if rustc is feature-staged unstable_features: UnstableFeatures::Allow, actually_rustdoc: true, + debugging_opts: config::DebuggingOptions { + force_unstable_if_unmarked: force_unstable_if_unmarked, + ..config::basic_debugging_options() + }, ..config::basic_options().clone() }; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 496662f442c..6c092d01a01 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -465,13 +465,17 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R { info!("starting to run rustc"); let display_warnings = matches.opt_present("display-warnings"); + let force_unstable_if_unmarked = matches.opt_strs("Z").iter().any(|x| { + *x == "force-unstable-if-unmarked" + }); + let (tx, rx) = channel(); rustc_driver::monitor(move || { use rustc::session::config::Input; let (mut krate, renderinfo) = core::run_core(paths, cfgs, externs, Input::File(cr), triple, maybe_sysroot, - display_warnings); + display_warnings, force_unstable_if_unmarked); info!("finished with rustc"); diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 8c4cbb66b45..aef88e3d563 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -2384,7 +2384,7 @@ impl BuildHasher for RandomState { /// [`Hasher`]: ../../hash/trait.Hasher.html #[stable(feature = "hashmap_default_hasher", since = "1.13.0")] #[allow(deprecated)] -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct DefaultHasher(SipHasher13); impl DefaultHasher { |
