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

Update stage0 bootstrap compiler #41544

Merged
merged 1 commit into from
Apr 29, 2017
Merged
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
11 changes: 5 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@
path = src/doc/nomicon
url = https://github.com/rust-lang-nursery/nomicon.git
[submodule "src/tools/cargo"]
path = cargo
url = https://github.com/rust-lang/cargo.git
path = src/tools/cargo
url = https://github.com/rust-lang/cargo
[submodule "reference"]
path = src/doc/reference
url = https://github.com/rust-lang-nursery/reference.git
[submodule "book"]
path = src/doc/book
url = https://github.com/rust-lang/book.git
[submodule "rls"]
path = rls
url = https://github.com/rust-lang-nursery/rls.git

[submodule "src/tools/rls"]
path = src/tools/rls
url = https://github.com/rust-lang-nursery/rls
1 change: 0 additions & 1 deletion cargo
Submodule cargo deleted from 03efb7
1 change: 0 additions & 1 deletion rls
Submodule rls deleted from 6ecff9
6 changes: 6 additions & 0 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ members = [
"tools/remote-test-server",
]

# These projects have their own Cargo.lock
exclude = [
"tools/cargo",
"tools/rls",
]

# 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.
Expand Down
44 changes: 27 additions & 17 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,40 +159,41 @@ def format_build_time(duration):
class RustBuild(object):
def download_stage0(self):
cache_dst = os.path.join(self.build_dir, "cache")
rustc_cache = os.path.join(cache_dst, self.stage0_rustc_date())
rustc_cache = os.path.join(cache_dst, self.stage0_date())
if not os.path.exists(rustc_cache):
os.makedirs(rustc_cache)

channel = self.stage0_rustc_channel()
rustc_channel = self.stage0_rustc_channel()
cargo_channel = self.stage0_cargo_channel()

if self.rustc().startswith(self.bin_root()) and \
(not os.path.exists(self.rustc()) or self.rustc_out_of_date()):
self.print_what_it_means_to_bootstrap()
if os.path.exists(self.bin_root()):
shutil.rmtree(self.bin_root())
filename = "rust-std-{}-{}.tar.gz".format(channel, self.build)
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
filename = "rust-std-{}-{}.tar.gz".format(rustc_channel, self.build)
url = self._download_url + "/dist/" + self.stage0_date()
tarball = os.path.join(rustc_cache, filename)
if not os.path.exists(tarball):
get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
unpack(tarball, self.bin_root(),
match="rust-std-" + self.build,
verbose=self.verbose)

filename = "rustc-{}-{}.tar.gz".format(channel, self.build)
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
filename = "rustc-{}-{}.tar.gz".format(rustc_channel, self.build)
url = self._download_url + "/dist/" + self.stage0_date()
tarball = os.path.join(rustc_cache, filename)
if not os.path.exists(tarball):
get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
unpack(tarball, self.bin_root(), match="rustc", verbose=self.verbose)
self.fix_executable(self.bin_root() + "/bin/rustc")
self.fix_executable(self.bin_root() + "/bin/rustdoc")
with open(self.rustc_stamp(), 'w') as f:
f.write(self.stage0_rustc_date())
f.write(self.stage0_date())

if "pc-windows-gnu" in self.build:
filename = "rust-mingw-{}-{}.tar.gz".format(channel, self.build)
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
filename = "rust-mingw-{}-{}.tar.gz".format(rustc_channel, self.build)
url = self._download_url + "/dist/" + self.stage0_date()
tarball = os.path.join(rustc_cache, filename)
if not os.path.exists(tarball):
get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
Expand All @@ -201,15 +202,15 @@ def download_stage0(self):
if self.cargo().startswith(self.bin_root()) and \
(not os.path.exists(self.cargo()) or self.cargo_out_of_date()):
self.print_what_it_means_to_bootstrap()
filename = "cargo-{}-{}.tar.gz".format(channel, self.build)
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build)
url = self._download_url + "/dist/" + self.stage0_date()
tarball = os.path.join(rustc_cache, filename)
if not os.path.exists(tarball):
get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
unpack(tarball, self.bin_root(), match="cargo", verbose=self.verbose)
self.fix_executable(self.bin_root() + "/bin/cargo")
with open(self.cargo_stamp(), 'w') as f:
f.write(self.stage0_rustc_date())
f.write(self.stage0_date())

def fix_executable(self, fname):
# If we're on NixOS we need to change the path to the dynamic loader
Expand Down Expand Up @@ -264,12 +265,15 @@ def fix_executable(self, fname):
print("warning: failed to call patchelf: %s" % e)
return

def stage0_rustc_date(self):
return self._rustc_date
def stage0_date(self):
return self._date

def stage0_rustc_channel(self):
return self._rustc_channel

def stage0_cargo_channel(self):
return self._cargo_channel

def rustc_stamp(self):
return os.path.join(self.bin_root(), '.rustc-stamp')

Expand All @@ -280,13 +284,13 @@ def rustc_out_of_date(self):
if not os.path.exists(self.rustc_stamp()) or self.clean:
return True
with open(self.rustc_stamp(), 'r') as f:
return self.stage0_rustc_date() != f.read()
return self.stage0_date() != f.read()

def cargo_out_of_date(self):
if not os.path.exists(self.cargo_stamp()) or self.clean:
return True
with open(self.cargo_stamp(), 'r') as f:
return self.stage0_rustc_date() != f.read()
return self.stage0_date() != f.read()

def bin_root(self):
return os.path.join(self.build_dir, self.build, "stage0")
Expand Down Expand Up @@ -585,7 +589,13 @@ def bootstrap():
shutil.rmtree('.cargo')

data = stage0_data(rb.rust_root)
rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
rb._date = data['date']
rb._rustc_channel = data['rustc']
rb._cargo_channel = data['cargo']
if 'dev' in data:
rb._download_url = 'https://dev-static.rust-lang.org'
else:
rb._download_url = 'https://static.rust-lang.org'

# Fetch/build the bootstrap
rb.build = rb.build_triple()
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use build_helper::output;
use Build;

// The version number
pub const CFG_RELEASE_NUM: &'static str = "1.18.0";
pub const CFG_RELEASE_NUM: &'static str = "1.19.0";

// An optional number to put after the label, e.g. '.2' -> '-beta.2'
// Be sure to make this starts with a dot to conform to semver pre-release
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub fn cargo(build: &Build, stage: u32, host: &str) {
let ref newpath = format!("{}{}{}", path.display(), sep, old_path);

let mut cargo = build.cargo(compiler, Mode::Tool, host, "test");
cargo.arg("--manifest-path").arg(build.src.join("cargo/Cargo.toml"));
cargo.arg("--manifest-path").arg(build.src.join("src/tools/cargo/Cargo.toml"));

// Don't build tests dynamically, just a pain to work with
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
Expand Down
5 changes: 1 addition & 4 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,7 @@ pub fn tool(build: &Build, stage: u32, target: &str, tool: &str) {
let compiler = Compiler::new(stage, &build.config.build);

let mut cargo = build.cargo(&compiler, Mode::Tool, target, "build");
let mut dir = build.src.join(tool);
if !dir.exists() {
dir = build.src.join("src/tools").join(tool);
}
let dir = build.src.join("src/tools").join(tool);
cargo.arg("--manifest-path").arg(dir.join("Cargo.toml"));

// We don't want to build tools dynamically as they'll be running across
Expand Down
6 changes: 2 additions & 4 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,6 @@ pub fn rust_src(build: &Build) {
let src_dirs = [
"man",
"src",
"cargo",
"rls",
];

let filter_fn = move |path: &Path| {
Expand Down Expand Up @@ -576,7 +574,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
println!("Dist cargo stage{} ({})", stage, target);
let compiler = Compiler::new(stage, &build.config.build);

let src = build.src.join("cargo");
let src = build.src.join("src/tools/cargo");
let etc = src.join("src/etc");
let release_num = build.release_num("cargo");
let name = pkgname(build, "cargo");
Expand Down Expand Up @@ -637,7 +635,7 @@ pub fn rls(build: &Build, stage: u32, target: &str) {
println!("Dist RLS stage{} ({})", stage, target);
let compiler = Compiler::new(stage, &build.config.build);

let src = build.src.join("rls");
let src = build.src.join("src/tools/rls");
let release_num = build.release_num("rls");
let name = pkgname(build, "rls");
let version = build.rls_info.version(build, &release_num);
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ impl Build {
None => false,
};
let rust_info = channel::GitInfo::new(&src);
let cargo_info = channel::GitInfo::new(&src.join("cargo"));
let rls_info = channel::GitInfo::new(&src.join("rls"));
let cargo_info = channel::GitInfo::new(&src.join("src/tools/cargo"));
let rls_info = channel::GitInfo::new(&src.join("src/tools/rls"));
let src_is_git = src.join(".git").exists();

Build {
Expand Down Expand Up @@ -1071,7 +1071,7 @@ impl Build {
/// Returns the `a.b.c` version that the given package is at.
fn release_num(&self, package: &str) -> String {
let mut toml = String::new();
let toml_file_name = self.src.join(&format!("{}/Cargo.toml", package));
let toml_file_name = self.src.join(&format!("src/tools/{}/Cargo.toml", package));
t!(t!(File::open(toml_file_name)).read_to_string(&mut toml));
for line in toml.lines() {
let prefix = "version = \"";
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
.dep(|s| s.name("maybe-clean-tools"))
.dep(|s| s.name("libstd-tool"))
.run(move |s| compile::tool(build, s.stage, s.target, "remote-test-client"));
rules.build("tool-cargo", "cargo")
rules.build("tool-cargo", "src/tools/cargo")
.host(true)
.default(build.config.extended)
.dep(|s| s.name("maybe-clean-tools"))
Expand All @@ -588,7 +588,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
.host(&build.config.build)
})
.run(move |s| compile::tool(build, s.stage, s.target, "cargo"));
rules.build("tool-rls", "rls")
rules.build("tool-rls", "src/tools/rls")
.host(true)
.default(build.config.extended)
.dep(|s| s.name("librustc-tool"))
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
#![feature(needs_allocator)]
#![feature(optin_builtin_traits)]
#![feature(placement_in_syntax)]
#![cfg_attr(stage0, feature(pub_restricted))]
#![feature(shared)]
#![feature(staged_api)]
#![feature(unboxed_closures)]
Expand Down
24 changes: 0 additions & 24 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
issue = "0")]
#![allow(missing_docs)]

#[cfg(not(stage0))]
#[stable(feature = "drop_in_place", since = "1.8.0")]
#[rustc_deprecated(reason = "no longer an intrinsic - use `ptr::drop_in_place` directly",
since = "1.18.0")]
Expand Down Expand Up @@ -645,27 +644,6 @@ extern "rust-intrinsic" {
pub fn size_of_val<T: ?Sized>(_: &T) -> usize;
pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;

#[cfg(stage0)]
/// Executes the destructor (if any) of the pointed-to value.
///
/// This has two use cases:
///
/// * It is *required* to use `drop_in_place` to drop unsized types like
/// trait objects, because they can't be read out onto the stack and
/// dropped normally.
///
/// * It is friendlier to the optimizer to do this over `ptr::read` when
/// dropping manually allocated memory (e.g. when writing Box/Rc/Vec),
/// as the compiler doesn't need to prove that it's sound to elide the
/// copy.
///
/// # Undefined Behavior
///
/// This has all the same safety problems as `ptr::read` with respect to
/// invalid pointers, types, and double drops.
#[stable(feature = "drop_in_place", since = "1.8.0")]
pub fn drop_in_place<T: ?Sized>(to_drop: *mut T);

/// Gets a static string slice containing the name of a type.
pub fn type_name<T: ?Sized>() -> &'static str;

Expand Down Expand Up @@ -1261,11 +1239,9 @@ extern "rust-intrinsic" {

/// Performs an unchecked left shift, resulting in undefined behavior when
/// y < 0 or y >= N, where N is the width of T in bits.
#[cfg(not(stage0))]
pub fn unchecked_shl<T>(x: T, y: T) -> T;
/// Performs an unchecked right shift, resulting in undefined behavior when
/// y < 0 or y >= N, where N is the width of T in bits.
#[cfg(not(stage0))]
pub fn unchecked_shr<T>(x: T, y: T) -> T;

/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ mod impls {
/// any `UnsafeCell` internally, but not through an indirection.
/// This affects, for example, whether a `static` of that type is
/// placed in read-only static memory or writable static memory.
#[cfg_attr(not(stage0), lang = "freeze")]
#[lang = "freeze"]
unsafe trait Freeze {}

unsafe impl Freeze for .. {}
Expand Down
Loading