Skip to content

Commit

Permalink
Update the bootstrap compiler
Browse files Browse the repository at this point in the history
Now that we've got a beta build, let's use it!
  • Loading branch information
alexcrichton committed Nov 30, 2016
1 parent 8e373b4 commit 2186660
Show file tree
Hide file tree
Showing 52 changed files with 30 additions and 559 deletions.
8 changes: 2 additions & 6 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ HOST_CRATES := syntax syntax_ext proc_macro_tokens proc_macro_plugin syntax_pos
TOOLS := compiletest rustdoc rustc rustbook error_index_generator

DEPS_core :=
DEPS_compiler_builtins := core
DEPS_compiler_builtins := core native:compiler-rt
DEPS_alloc := core libc alloc_system
DEPS_alloc_system := core libc
DEPS_alloc_jemalloc := core libc native:jemalloc
Expand All @@ -79,11 +79,7 @@ DEPS_panic_unwind := libc alloc unwind
DEPS_unwind := libc

RUSTFLAGS_compiler_builtins := -lstatic=compiler-rt

# FIXME(stage0): change this to just `RUSTFLAGS_panic_abort := ...`
RUSTFLAGS1_panic_abort := -C panic=abort
RUSTFLAGS2_panic_abort := -C panic=abort
RUSTFLAGS3_panic_abort := -C panic=abort
RUSTFLAGS_panic_abort := -C panic=abort

DEPS_std := core libc rand alloc collections compiler_builtins rustc_unicode \
native:backtrace \
Expand Down
10 changes: 2 additions & 8 deletions mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,12 @@ CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATUR
# Turn on feature-staging
export CFG_DISABLE_UNSTABLE_FEATURES
# Subvert unstable feature lints to do the self-build
export RUSTC_BOOTSTRAP=1
endif
ifdef CFG_MUSL_ROOT
export CFG_MUSL_ROOT
endif

# FIXME: Transitionary measure to bootstrap using the old bootstrap logic.
# Remove this once the bootstrap compiler uses the new login in Issue #36548.
export RUSTC_BOOTSTRAP_KEY=62b3e239
export RUSTC_BOOTSTRAP := 1

######################################################################
# Per-stage targets and runner
Expand Down Expand Up @@ -443,10 +440,7 @@ endif
TSREQ$(1)_T_$(2)_H_$(3) = \
$$(HSREQ$(1)_H_$(3)) \
$$(foreach obj,$$(REQUIRED_OBJECTS_$(2)),\
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj)) \
$$(TLIB0_T_$(2)_H_$(3))/$$(call CFG_STATIC_LIB_NAME_$(2),compiler-rt)
# ^ This copies `libcompiler-rt.a` to the stage0 sysroot
# ^ TODO(stage0) update this to not copy `libcompiler-rt.a` to stage0
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj))

# Prerequisites for a working stageN compiler and libraries, for a specific
# target
Expand Down
7 changes: 0 additions & 7 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,20 @@ members = [
"tools/rustbook",
"tools/tidy",
]

# Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit
# MSVC when running the compile-fail test suite when a should-fail test panics.
# But hey if this is removed and it gets past the bots, sounds good to me.
[profile.release]
opt-level = 2
[profile.bench]
opt-level = 2

# These options are controlled from our rustc wrapper script, so turn them off
# here and have them controlled elsewhere.
[profile.dev]
debug = false
debug-assertions = false
[profile.test]
debug = false
debug-assertions = false
1 change: 0 additions & 1 deletion src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ getopts = "0.2"
rustc-serialize = "0.3"
gcc = "0.3.38"
libc = "0.2"
md5 = "0.1"
17 changes: 0 additions & 17 deletions src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use std::io::prelude::*;
use std::process::Command;

use build_helper::output;
use md5;

use Build;

Expand Down Expand Up @@ -91,20 +90,4 @@ pub fn collect(build: &mut Build) {
build.ver_hash = Some(ver_hash);
build.short_ver_hash = Some(short_ver_hash);
}

// 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]);

// Slurp up the stage0 bootstrap key as we're bootstrapping from an
// otherwise stable compiler.
let mut s = String::new();
t!(t!(File::open(build.src.join("src/stage0.txt"))).read_to_string(&mut s));
if let Some(line) = s.lines().find(|l| l.starts_with("rustc_key")) {
if let Some(key) = line.split(": ").nth(1) {
build.bootstrap_key_stage0 = key.to_string();
}
}
}
2 changes: 1 addition & 1 deletion src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ pub fn compiletest(build: &Build,
}
}
}
build.add_bootstrap_key(&mut cmd);
cmd.env("RUSTC_BOOTSTRAP", "1");

cmd.arg("--adb-path").arg("adb");
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ fn build_startup_objects(build: &Build, target: &str, into: &Path) {
for file in t!(fs::read_dir(build.src.join("src/rtstartup"))) {
let file = t!(file);
let mut cmd = Command::new(&compiler_path);
build.add_bootstrap_key(&mut cmd);
build.run(cmd.arg("--target").arg(target)
build.run(cmd.env("RUSTC_BOOTSTRAP", "1")
.arg("--target").arg(target)
.arg("--emit=obj")
.arg("--out-dir").arg(into)
.arg(file.path()));
Expand Down
16 changes: 2 additions & 14 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ extern crate cmake;
extern crate filetime;
extern crate gcc;
extern crate getopts;
extern crate md5;
extern crate num_cpus;
extern crate rustc_serialize;
extern crate toml;
Expand Down Expand Up @@ -120,8 +119,6 @@ pub struct Build {
version: String,
package_vers: String,
local_rebuild: bool,
bootstrap_key: String,
bootstrap_key_stage0: String,

// Probed tools at runtime
lldb_version: Option<String>,
Expand Down Expand Up @@ -205,8 +202,6 @@ impl Build {
ver_date: None,
version: String::new(),
local_rebuild: local_rebuild,
bootstrap_key: String::new(),
bootstrap_key_stage0: String::new(),
package_vers: String::new(),
cc: HashMap::new(),
cxx: HashMap::new(),
Expand Down Expand Up @@ -438,7 +433,8 @@ impl Build {
.env("RUSTDOC_REAL", self.rustdoc(compiler))
.env("RUSTC_FLAGS", self.rustc_flags(target).join(" "));

self.add_bootstrap_key(&mut cargo);
// Enable usage of unstable features
cargo.env("RUSTC_BOOTSTRAP", "1");

// Specify some various options for build scripts used throughout
// the build.
Expand Down Expand Up @@ -655,14 +651,6 @@ impl Build {
add_lib_path(vec![self.rustc_libdir(compiler)], cmd);
}

/// Adds the compiler's bootstrap key to the environment of `cmd`.
fn add_bootstrap_key(&self, cmd: &mut Command) {
cmd.env("RUSTC_BOOTSTRAP", "1");
// FIXME: Transitionary measure to bootstrap using the old bootstrap logic.
// Remove this once the bootstrap compiler uses the new login in Issue #36548.
cmd.env("RUSTC_BOOTSTRAP_KEY", "62b3e239");
}

/// Returns the compiler's libdir where it stores the dynamic libraries that
/// it itself links against.
///
Expand Down
1 change: 0 additions & 1 deletion src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
#![feature(specialization)]
#![feature(staged_api)]
#![feature(unboxed_closures)]
#![cfg_attr(stage0, feature(question_mark))]
#![feature(never_type)]
#![feature(prelude_import)]

Expand Down
1 change: 0 additions & 1 deletion src/libgraphviz/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(str_escape)]
#![cfg_attr(stage0, feature(question_mark))]

use self::LabelText::*;

Expand Down
2 changes: 0 additions & 2 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#![feature(conservative_impl_trait)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![cfg_attr(stage0, feature(item_like_imports))]
#![feature(libc)]
#![feature(nonzero)]
Expand All @@ -41,7 +40,6 @@
#![feature(slice_patterns)]
#![feature(staged_api)]
#![feature(unboxed_closures)]
#![cfg_attr(stage0, feature(question_mark))]
#![cfg_attr(test, feature(test))]

extern crate arena;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#![feature(rand)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![cfg_attr(stage0, feature(question_mark))]
#![cfg_attr(test, feature(rand))]

extern crate syntax;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_borrowck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@

#![allow(non_camel_case_types)]

#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(associated_consts)]
#![feature(nonzero)]
#![cfg_attr(stage0, feature(question_mark))]
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
extern crate syntax_pos;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_const_eval/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]

#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_patterns)]
#![cfg_attr(stage0, feature(question_mark))]
#![feature(box_patterns)]
#![feature(box_syntax)]

Expand Down
1 change: 0 additions & 1 deletion src/librustc_const_math/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#![feature(rustc_private)]
#![feature(staged_api)]
#![cfg_attr(stage0, feature(question_mark))]

#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(box_syntax)]
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(libc)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(set_stdio)]
#![feature(staged_api)]
#![cfg_attr(stage0, feature(question_mark))]

extern crate arena;
extern crate flate;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#![allow(unused_attributes)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![cfg_attr(stage0, feature(question_mark))]
#![feature(range_contains)]
#![feature(libc)]
#![feature(unicode)]
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_incremental/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![cfg_attr(stage0, feature(question_mark))]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(rand)]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#![cfg_attr(test, feature(test))]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@

#![feature(associated_consts)]
#![feature(box_syntax)]
#![feature(concat_idents)]
#![feature(libc)]
#![feature(link_args)]
#![feature(staged_api)]
#![feature(linked_from)]
#![feature(concat_idents)]
#![feature(staged_api)]

extern crate libc;

Expand Down
2 changes: 0 additions & 2 deletions src/librustc_metadata/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
#![feature(box_patterns)]
#![feature(conservative_impl_trait)]
#![feature(core_intrinsics)]
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(proc_macro_internals)]
#![feature(proc_macro_lib)]
#![cfg_attr(stage0, feature(question_mark))]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!

#![feature(associated_consts)]
#![feature(box_patterns)]
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![cfg_attr(stage0, feature(item_like_imports))]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![cfg_attr(stage0, feature(question_mark))]

#[macro_use] extern crate log;
extern crate graphviz as dot;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_passes/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(rustc_diagnostic_macros)]
#![feature(staged_api)]
#![feature(rustc_private)]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_privacy/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))]

#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#![feature(associated_consts)]
#![feature(borrow_state)]
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#![cfg_attr(not(stage0), deny(warnings))]

#![feature(custom_attribute)]
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![allow(unused_attributes)]
#![feature(rustc_private)]
#![feature(staged_api)]
Expand Down
Loading

0 comments on commit 2186660

Please sign in to comment.