Skip to content
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
8 changes: 4 additions & 4 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ fn main() {
} else {
("RUSTC_REAL", "RUSTC_LIBDIR")
};
let stage = env::var("RUSTC_STAGE").unwrap();
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");

let rustc = env::var_os(rustc).unwrap();
let libdir = env::var_os(libdir).unwrap();
let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc));
let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir));
let mut dylib_path = bootstrap::util::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));

Expand All @@ -71,7 +71,7 @@ fn main() {
if let Some(target) = target {
// The stage0 compiler has a special sysroot distinct from what we
// actually downloaded, so we just always pass the `--sysroot` option.
cmd.arg("--sysroot").arg(env::var_os("RUSTC_SYSROOT").unwrap());
cmd.arg("--sysroot").arg(env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set"));

// When we build Rust dylibs they're all intended for intermediate
// usage, so make sure we pass the -Cprefer-dynamic flag instead of
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ use std::path::PathBuf;

fn main() {
let args = env::args_os().skip(1).collect::<Vec<_>>();
let rustdoc = env::var_os("RUSTDOC_REAL").unwrap();
let libdir = env::var_os("RUSTC_LIBDIR").unwrap();
let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
let libdir = env::var_os("RUSTC_LIBDIR").expect("RUSTC_LIBDIR was not set");
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");

let mut dylib_path = bootstrap::util::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));

let mut cmd = Command::new(rustdoc);
cmd.args(&args)
.arg("--cfg").arg(format!("stage{}", env::var("RUSTC_STAGE").unwrap()))
.arg("--cfg").arg(format!("stage{}", stage))
.arg("--cfg").arg("dox")
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());
Expand All @@ -37,4 +38,3 @@ fn main() {
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
})
}

6 changes: 3 additions & 3 deletions src/liballoc_jemalloc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ fn main() {
println!("cargo:rustc-cfg=cargobuild");
println!("cargo:rerun-if-changed=build.rs");

let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
let host = env::var("HOST").expect("HOST was not set");
let build_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let src_dir = env::current_dir().unwrap();

Expand Down Expand Up @@ -140,7 +140,7 @@ fn main() {
.current_dir(&build_dir)
.arg("build_lib_static")
.arg("-j")
.arg(env::var("NUM_JOBS").unwrap()));
.arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set")));

if target.contains("windows") {
println!("cargo:rustc-link-lib=static=jemalloc");
Expand Down
2 changes: 1 addition & 1 deletion src/libcompiler_builtins/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Sources {
}

fn main() {
let target = env::var("TARGET").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
let cfg = &mut gcc::Config::new();

if target.contains("msvc") {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use build_helper::output;
fn main() {
println!("cargo:rustc-cfg=cargobuild");

let target = env::var("TARGET").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
let llvm_config = env::var_os("LLVM_CONFIG")
.map(PathBuf::from)
.unwrap_or_else(|| {
Expand Down Expand Up @@ -62,8 +62,8 @@ fn main() {
// can't trust all the output of llvm-config becaues it might be targeted
// for the host rather than the target. As a result a bunch of blocks below
// are gated on `if !is_crossed`
let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
let host = env::var("HOST").expect("HOST was not set");
let is_crossed = target != host;

let optional_components = ["x86", "arm", "aarch64", "mips", "powerpc", "pnacl", "systemz"];
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ fn main() {
println!("cargo:rustc-cfg=cargobuild");
println!("cargo:rerun-if-changed=build.rs");

let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
let host = env::var("HOST").expect("HOST was not set");
if cfg!(feature = "backtrace") && !target.contains("apple") && !target.contains("msvc") &&
!target.contains("emscripten") {
build_libbacktrace(&host, &target);
Expand Down Expand Up @@ -103,5 +103,5 @@ fn build_libbacktrace(host: &str, target: &str) {
run(Command::new("make")
.current_dir(&build_dir)
.arg(format!("INCDIR={}", src_dir.display()))
.arg("-j").arg(env::var("NUM_JOBS").unwrap()));
.arg("-j").arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set")));
}
2 changes: 1 addition & 1 deletion src/libunwind/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::env;
fn main() {
println!("cargo:rustc-cfg=cargobuild");

let target = env::var("TARGET").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");

if target.contains("linux") {
if target.contains("musl") && !target.contains("mips") {
Expand Down