Skip to content
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

run rustfmt on bootstrap folder #37210

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 14 additions & 10 deletions src/bootstrap/cc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ pub fn find(build: &mut Build) {
// and such as well as for being a linker for Rust code.
for target in build.config.target.iter() {
let mut cfg = gcc::Config::new();
cfg.cargo_metadata(false).opt_level(0).debug(false)
.target(target).host(&build.config.build);
cfg.cargo_metadata(false)
.opt_level(0)
.debug(false)
.target(target)
.host(&build.config.build);

let config = build.config.target_config.get(target);
if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
Expand All @@ -66,8 +69,12 @@ 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() {
let mut cfg = gcc::Config::new();
cfg.cargo_metadata(false).opt_level(0).debug(false).cpp(true)
.target(host).host(&build.config.build);
cfg.cargo_metadata(false)
.opt_level(0)
.debug(false)
.cpp(true)
.target(host)
.host(&build.config.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 All @@ -80,10 +87,7 @@ pub fn find(build: &mut Build) {
}
}

fn set_compiler(cfg: &mut gcc::Config,
gnu_compiler: &str,
target: &str,
config: Option<&Target>) {
fn set_compiler(cfg: &mut gcc::Config, gnu_compiler: &str, target: &str, config: Option<&Target>) {
match target {
// When compiling for android we may have the NDK configured in the
// config.toml in which case we look there. Otherwise the default
Expand All @@ -101,7 +105,7 @@ fn set_compiler(cfg: &mut gcc::Config,
t if t.contains("openbsd") => {
let c = cfg.get_compiler();
if !c.path().ends_with(gnu_compiler) {
return
return;
}

let output = output(c.to_command().arg("--version"));
Expand All @@ -110,7 +114,7 @@ fn set_compiler(cfg: &mut gcc::Config,
None => return,
};
match output[i + 3..].chars().next().unwrap() {
'0' ... '6' => {}
'0'...'6' => {}
_ => return,
}
let alternative = format!("e{}", gnu_compiler);
Expand Down
33 changes: 17 additions & 16 deletions src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ pub fn collect(build: &mut Build) {
build.unstable_features = false;
}
"beta" => {
build.release = format!("{}-beta{}", release_num,
prerelease_version);
build.release = format!("{}-beta{}", release_num, prerelease_version);
build.package_vers = "beta".to_string();
build.unstable_features = false;
}
Expand All @@ -71,22 +70,25 @@ pub fn collect(build: &mut Build) {
// If we have a git directory, add in some various SHA information of what
// commit this compiler was compiled from.
if fs::metadata(build.src.join(".git")).is_ok() {
let ver_date = output(Command::new("git").current_dir(&build.src)
.arg("log").arg("-1")
.arg("--date=short")
.arg("--pretty=format:%cd"));
let ver_hash = output(Command::new("git").current_dir(&build.src)
.arg("rev-parse").arg("HEAD"));
let ver_date = output(Command::new("git")
.current_dir(&build.src)
.arg("log")
.arg("-1")
.arg("--date=short")
.arg("--pretty=format:%cd"));
let ver_hash = output(Command::new("git")
.current_dir(&build.src)
.arg("rev-parse")
.arg("HEAD"));
let short_ver_hash = output(Command::new("git")
.current_dir(&build.src)
.arg("rev-parse")
.arg("--short=9")
.arg("HEAD"));
.current_dir(&build.src)
.arg("rev-parse")
.arg("--short=9")
.arg("HEAD"));
let ver_date = ver_date.trim().to_string();
let ver_hash = ver_hash.trim().to_string();
let short_ver_hash = short_ver_hash.trim().to_string();
build.version.push_str(&format!(" ({} {})", short_ver_hash,
ver_date));
build.version.push_str(&format!(" ({} {})", short_ver_hash, ver_date));
build.ver_date = Some(ver_date.to_string());
build.ver_hash = Some(ver_hash);
build.short_ver_hash = Some(short_ver_hash);
Expand All @@ -95,8 +97,7 @@ pub fn collect(build: &mut Build) {
// Calculate this compiler's bootstrap key, which is currently defined as
// the first 8 characters of the md5 of the release string.
let key = md5::compute(build.release.as_bytes());
build.bootstrap_key = format!("{:02x}{:02x}{:02x}{:02x}",
key[0], key[1], key[2], key[3]);
build.bootstrap_key = format!("{:02x}{:02x}{:02x}{:02x}", key[0], key[1], key[2], key[3]);

// Slurp up the stage0 bootstrap key as we're bootstrapping from an
// otherwise stable compiler.
Expand Down
Loading