Skip to content

Commit

Permalink
Allow disabling LLVM assertions in rustc (fixes #15548)
Browse files Browse the repository at this point in the history
  • Loading branch information
nox authored and SimonSapin committed Feb 15, 2017
1 parent 336e6c8 commit 57fd45a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 6 additions & 1 deletion python/servo/bootstrap_commands.py
Expand Up @@ -70,6 +70,8 @@ def bootstrap_rustc(self, force=False, target=[], stable=False):
rust_path = self.rust_path()
rust_dir = path.join(self.context.sharedir, "rust", rust_path)
install_dir = path.join(self.context.sharedir, "rust", version)
if not self.config["build"]["llvm-assertions"]:
install_dir += "-alt"

if not force and path.exists(path.join(rust_dir, "rustc", "bin", "rustc" + BIN_SUFFIX)):
print("Rust compiler already downloaded.", end=" ")
Expand All @@ -89,7 +91,10 @@ def bootstrap_rustc(self, force=False, target=[], stable=False):
rustc_url = "https://static-rust-lang-org.s3.amazonaws.com/dist/" + tarball
else:
tarball = "%s/rustc-nightly-%s.tar.gz" % (version, host_triple())
rustc_url = "https://s3.amazonaws.com/rust-lang-ci/rustc-builds/" + tarball
base_url = "https://s3.amazonaws.com/rust-lang-ci/rustc-builds"
if not self.config["build"]["llvm-assertions"]:
base_url += "-alt"
rustc_url = base_url + "/" + tarball
tgz_file = rust_dir + '-rustc.tar.gz'

download_file("Rust compiler", rustc_url, tgz_file)
Expand Down
9 changes: 6 additions & 3 deletions python/servo/command_base.py
Expand Up @@ -258,7 +258,6 @@ def resolverelative(category, key):
self.config["tools"].setdefault("system-cargo", False)
self.config["tools"].setdefault("rust-root", "")
self.config["tools"].setdefault("cargo-root", "")
self.set_use_stable_rust(False)
if not self.config["tools"]["system-cargo"]:
self.config["tools"]["cargo-root"] = path.join(
context.sharedir, "cargo", self.cargo_build_id())
Expand All @@ -267,6 +266,7 @@ def resolverelative(category, key):
self.config.setdefault("build", {})
self.config["build"].setdefault("android", False)
self.config["build"].setdefault("mode", "")
self.config["build"].setdefault("llvm-assertions", True)
self.config["build"].setdefault("debug-mozjs", False)
self.config["build"].setdefault("ccache", "")
self.config["build"].setdefault("rustflags", "")
Expand All @@ -279,6 +279,8 @@ def resolverelative(category, key):
self.config["android"].setdefault("platform", "android-18")
self.config["android"].setdefault("target", "arm-linux-androideabi")

self.set_use_stable_rust(False)

_use_stable_rust = False
_rust_version = None
_rust_version_is_stable = False
Expand All @@ -297,8 +299,9 @@ def rust_path(self):
version = self.rust_version()
if self._use_stable_rust:
return os.path.join(version, "rustc-%s-%s" % (version, host_triple()))
else:
return os.path.join(version, "rustc-nightly-%s" % (host_triple()))
if not self.config["build"]["llvm-assertions"]:
version += "-alt"
return os.path.join(version, "rustc-nightly-%s" % (host_triple()))

def rust_version(self):
if self._rust_version is None or self._use_stable_rust != self._rust_version_is_stable:
Expand Down
3 changes: 3 additions & 0 deletions servobuild.example
Expand Up @@ -39,6 +39,9 @@ rustc-with-gold = true
# Defaults to prompting before building
#mode = "dev"

# Whether to enable LLVM assertions in rustc.
#llvm-assertions = true

# Set "android = true" or use `mach build --android` to build the Android app.
android = false

Expand Down

0 comments on commit 57fd45a

Please sign in to comment.