Skip to content

Commit

Permalink
Format the world
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Dec 22, 2019
1 parent 8eb7c58 commit a06baa5
Show file tree
Hide file tree
Showing 1,160 changed files with 66,321 additions and 74,703 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/bin/llvm-config-wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// `src/bootstrap/native.rs` for why this is needed when compiling LLD.

use std::env;
use std::process::{self, Stdio, Command};
use std::io::{self, Write};
use std::process::{self, Command, Stdio};

fn main() {
let real_llvm_config = env::var_os("LLVM_CONFIG_REAL").unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use std::env;

use bootstrap::{Config, Build};
use bootstrap::{Build, Config};

fn main() {
let args = env::args().skip(1).collect::<Vec<_>>();
Expand Down
46 changes: 24 additions & 22 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ fn main() {

// Detect whether or not we're a build script depending on whether --target
// is passed (a bit janky...)
let target = args.windows(2)
.find(|w| &*w[0] == "--target")
.and_then(|w| w[1].to_str());
let target = args.windows(2).find(|w| &*w[0] == "--target").and_then(|w| w[1].to_str());
let version = args.iter().find(|w| &**w == "-vV");

let verbose = match env::var("RUSTC_VERBOSE") {
Expand Down Expand Up @@ -57,19 +55,16 @@ fn main() {
dylib_path.insert(0, PathBuf::from(&libdir));

let mut cmd = Command::new(rustc);
cmd.args(&args)
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());
cmd.args(&args).env(bootstrap::util::dylib_path_var(), env::join_paths(&dylib_path).unwrap());

// Get the name of the crate we're compiling, if any.
let crate_name = args.windows(2)
.find(|args| args[0] == "--crate-name")
.and_then(|args| args[1].to_str());
let crate_name =
args.windows(2).find(|args| args[0] == "--crate-name").and_then(|args| args[1].to_str());

if let Some(crate_name) = crate_name {
if let Some(target) = env::var_os("RUSTC_TIME") {
if target == "all" ||
target.into_string().unwrap().split(",").any(|c| c.trim() == crate_name)
if target == "all"
|| target.into_string().unwrap().split(",").any(|c| c.trim() == crate_name)
{
cmd.arg("-Ztime");
}
Expand Down Expand Up @@ -101,15 +96,22 @@ fn main() {
// `compiler_builtins` are unconditionally compiled with panic=abort to
// workaround undefined references to `rust_eh_unwind_resume` generated
// otherwise, see issue https://github.com/rust-lang/rust/issues/43095.
if crate_name == Some("panic_abort") ||
crate_name == Some("compiler_builtins") && stage != "0" {
if crate_name == Some("panic_abort")
|| crate_name == Some("compiler_builtins") && stage != "0"
{
cmd.arg("-C").arg("panic=abort");
}

// Set various options from config.toml to configure how we're building
// code.
let debug_assertions = match env::var("RUSTC_DEBUG_ASSERTIONS") {
Ok(s) => if s == "true" { "y" } else { "n" },
Ok(s) => {
if s == "true" {
"y"
} else {
"n"
}
}
Err(..) => "n",
};

Expand Down Expand Up @@ -178,17 +180,17 @@ fn main() {
if env::var_os("RUSTC_PRINT_STEP_TIMINGS").is_some() {
if let Some(crate_name) = crate_name {
let start = Instant::now();
let status = cmd
.status()
.unwrap_or_else(|_| panic!("\n\n failed to run {:?}", cmd));
let status = cmd.status().unwrap_or_else(|_| panic!("\n\n failed to run {:?}", cmd));
let dur = start.elapsed();

let is_test = args.iter().any(|a| a == "--test");
eprintln!("[RUSTC-TIMING] {} test:{} {}.{:03}",
crate_name,
is_test,
dur.as_secs(),
dur.subsec_nanos() / 1_000_000);
eprintln!(
"[RUSTC-TIMING] {} test:{} {}.{:03}",
crate_name,
is_test,
dur.as_secs(),
dur.subsec_nanos() / 1_000_000
);

match status.code() {
Some(i) => std::process::exit(i),
Expand Down
16 changes: 6 additions & 10 deletions src/bootstrap/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
//! See comments in `src/bootstrap/rustc.rs` for more information.
use std::env;
use std::process::Command;
use std::path::PathBuf;
use std::ffi::OsString;
use std::path::PathBuf;
use std::process::Command;

fn main() {
let args = env::args_os().skip(1).collect::<Vec<_>>();
Expand Down Expand Up @@ -35,8 +35,7 @@ fn main() {
.arg("dox")
.arg("--sysroot")
.arg(&sysroot)
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());
.env(bootstrap::util::dylib_path_var(), env::join_paths(&dylib_path).unwrap());

// Force all crates compiled by this compiler to (a) be unstable and (b)
// allow the `rustc_private` feature to link to other unstable crates
Expand All @@ -55,8 +54,7 @@ fn main() {
if let Some(version) = env::var_os("RUSTDOC_CRATE_VERSION") {
// This "unstable-options" can be removed when `--crate-version` is stabilized
if !has_unstable {
cmd.arg("-Z")
.arg("unstable-options");
cmd.arg("-Z").arg("unstable-options");
}
cmd.arg("--crate-version").arg(version);
has_unstable = true;
Expand All @@ -66,8 +64,7 @@ fn main() {
if let Some(_) = env::var_os("RUSTDOC_GENERATE_REDIRECT_PAGES") {
// This "unstable-options" can be removed when `--generate-redirect-pages` is stabilized
if !has_unstable {
cmd.arg("-Z")
.arg("unstable-options");
cmd.arg("-Z").arg("unstable-options");
}
cmd.arg("--generate-redirect-pages");
has_unstable = true;
Expand All @@ -77,8 +74,7 @@ fn main() {
if let Some(ref x) = env::var_os("RUSTDOC_RESOURCE_SUFFIX") {
// This "unstable-options" can be removed when `--resource-suffix` is stabilized
if !has_unstable {
cmd.arg("-Z")
.arg("unstable-options");
cmd.arg("-Z").arg("unstable-options");
}
cmd.arg("--resource-suffix").arg(x);
}
Expand Down
12 changes: 6 additions & 6 deletions src/bootstrap/bin/sccache-plus-cl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ fn main() {
env::set_var("CXX", env::var_os("SCCACHE_CXX").unwrap());
let mut cfg = cc::Build::new();
cfg.cargo_metadata(false)
.out_dir("/")
.target(&target)
.host(&target)
.opt_level(0)
.warnings(false)
.debug(false);
.out_dir("/")
.target(&target)
.host(&target)
.opt_level(0)
.warnings(false)
.debug(false);
let compiler = cfg.get_compiler();

// Invoke sccache with said compiler
Expand Down
Loading

0 comments on commit a06baa5

Please sign in to comment.