Skip to content
Permalink
Browse files

Format the world

  • Loading branch information
Mark-Simulacrum committed Dec 22, 2019
1 parent 8eb7c58 commit a06baa56b95674fc626b3c3fd680d6a65357fe60
Showing 1,160 changed files with 66,321 additions and 74,703 deletions.
@@ -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();
@@ -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<_>>();
@@ -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") {
@@ -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");
}
@@ -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",
};

@@ -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),
@@ -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<_>>();
@@ -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
@@ -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;
@@ -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;
@@ -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);
}
@@ -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

0 comments on commit a06baa5

Please sign in to comment.
You can’t perform that action at this time.