Skip to content

Commit 74fa279

Browse files
committed
Auto merge of #42824 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 4 pull requests - Successful merges: #42799, #42804, #42805, #42806 - Failed merges:
2 parents 6f01c84 + 7f693e2 commit 74fa279

File tree

8 files changed

+66
-8
lines changed

8 files changed

+66
-8
lines changed

src/bootstrap/bin/rustc.rs

+9
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,15 @@ fn main() {
236236
}
237237
}
238238

239+
let color = match env::var("RUSTC_COLOR") {
240+
Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"),
241+
Err(_) => 0,
242+
};
243+
244+
if color != 0 {
245+
cmd.arg("--color=always");
246+
}
247+
239248
if verbose > 1 {
240249
writeln!(&mut io::stderr(), "rustc command: {:?}", cmd).unwrap();
241250
}

src/bootstrap/bin/rustdoc.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ fn main() {
4141
.env(bootstrap::util::dylib_path_var(),
4242
env::join_paths(&dylib_path).unwrap());
4343

44-
// Pass the `rustbuild` feature flag to crates which rustbuild is
45-
// building. See the comment in bootstrap/lib.rs where this env var is
46-
// set for more details.
47-
if env::var_os("RUSTBUILD_UNSTABLE").is_some() {
48-
cmd.arg("--cfg").arg("rustbuild");
44+
// Force all crates compiled by this compiler to (a) be unstable and (b)
45+
// allow the `rustc_private` feature to link to other unstable crates
46+
// also in the sysroot.
47+
if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
48+
cmd.arg("-Z").arg("force-unstable-if-unmarked");
4949
}
5050

5151
std::process::exit(match cmd.status() {

src/bootstrap/bootstrap.py

+1
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ def bootstrap():
668668
env["BUILD"] = rb.build
669669
env["SRC"] = rb.rust_root
670670
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
671+
env["BOOTSTRAP_PYTHON"] = sys.executable
671672
run(args, env=env, verbose=rb.verbose)
672673

673674

src/bootstrap/compile.rs

+32
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,43 @@ pub fn tool(build: &Build, stage: u32, target: &str, tool: &str) {
477477
build.run(&mut cargo);
478478
}
479479

480+
481+
// Avoiding a dependency on winapi to keep compile times down
482+
#[cfg(unix)]
483+
fn stderr_isatty() -> bool {
484+
use libc;
485+
unsafe { libc::isatty(libc::STDERR_FILENO) != 0 }
486+
}
487+
#[cfg(windows)]
488+
fn stderr_isatty() -> bool {
489+
type DWORD = u32;
490+
type BOOL = i32;
491+
type HANDLE = *mut u8;
492+
const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
493+
extern "system" {
494+
fn GetStdHandle(which: DWORD) -> HANDLE;
495+
fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: *mut DWORD) -> BOOL;
496+
}
497+
unsafe {
498+
let handle = GetStdHandle(STD_ERROR_HANDLE);
499+
let mut out = 0;
500+
GetConsoleMode(handle, &mut out) != 0
501+
}
502+
}
503+
480504
fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
481505
// Instruct Cargo to give us json messages on stdout, critically leaving
482506
// stderr as piped so we can get those pretty colors.
483507
cargo.arg("--message-format").arg("json")
484508
.stdout(Stdio::piped());
509+
510+
if stderr_isatty() {
511+
// since we pass message-format=json to cargo, we need to tell the rustc
512+
// wrapper to give us colored output if necessary. This is because we
513+
// only want Cargo's JSON output, not rustcs.
514+
cargo.env("RUSTC_COLOR", "1");
515+
}
516+
485517
build.verbose(&format!("running: {:?}", cargo));
486518
let mut child = match cargo.spawn() {
487519
Ok(child) => child,

src/bootstrap/sanity.rs

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use std::env;
2323
use std::ffi::{OsStr, OsString};
2424
use std::fs;
2525
use std::process::Command;
26+
use std::path::PathBuf;
2627

2728
use build_helper::output;
2829

@@ -86,6 +87,12 @@ pub fn check(build: &mut Build) {
8687
}
8788
}
8889

90+
if build.config.python.is_none() {
91+
// set by bootstrap.py
92+
if let Some(v) = env::var_os("BOOTSTRAP_PYTHON") {
93+
build.config.python = Some(PathBuf::from(v));
94+
}
95+
}
8996
if build.config.python.is_none() {
9097
build.config.python = have_cmd("python2.7".as_ref());
9198
}

src/librustdoc/core.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ pub fn run_core(search_paths: SearchPaths,
106106
input: Input,
107107
triple: Option<String>,
108108
maybe_sysroot: Option<PathBuf>,
109-
allow_warnings: bool) -> (clean::Crate, RenderInfo)
109+
allow_warnings: bool,
110+
force_unstable_if_unmarked: bool) -> (clean::Crate, RenderInfo)
110111
{
111112
// Parse, resolve, and typecheck the given crate.
112113

@@ -128,6 +129,10 @@ pub fn run_core(search_paths: SearchPaths,
128129
// Ensure that rustdoc works even if rustc is feature-staged
129130
unstable_features: UnstableFeatures::Allow,
130131
actually_rustdoc: true,
132+
debugging_opts: config::DebuggingOptions {
133+
force_unstable_if_unmarked: force_unstable_if_unmarked,
134+
..config::basic_debugging_options()
135+
},
131136
..config::basic_options().clone()
132137
};
133138

src/librustdoc/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -465,13 +465,17 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R {
465465
info!("starting to run rustc");
466466
let display_warnings = matches.opt_present("display-warnings");
467467

468+
let force_unstable_if_unmarked = matches.opt_strs("Z").iter().any(|x| {
469+
*x == "force-unstable-if-unmarked"
470+
});
471+
468472
let (tx, rx) = channel();
469473
rustc_driver::monitor(move || {
470474
use rustc::session::config::Input;
471475

472476
let (mut krate, renderinfo) =
473477
core::run_core(paths, cfgs, externs, Input::File(cr), triple, maybe_sysroot,
474-
display_warnings);
478+
display_warnings, force_unstable_if_unmarked);
475479

476480
info!("finished with rustc");
477481

src/libstd/collections/hash/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2384,7 +2384,7 @@ impl BuildHasher for RandomState {
23842384
/// [`Hasher`]: ../../hash/trait.Hasher.html
23852385
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
23862386
#[allow(deprecated)]
2387-
#[derive(Debug)]
2387+
#[derive(Clone, Debug)]
23882388
pub struct DefaultHasher(SipHasher13);
23892389

23902390
impl DefaultHasher {

0 commit comments

Comments
 (0)