diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-04-23 15:56:58 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-04-24 19:59:49 -0400 |
| commit | 77a975df85694a4de07abb5f99f1159799b1160d (patch) | |
| tree | edf320deb1d3348fa0604e2bd3d0e890daf9c671 | |
| parent | 7d70434a1e0ba68753b7d1e83f594dea6d23dd51 (diff) | |
| download | rust-77a975df85694a4de07abb5f99f1159799b1160d.tar.gz rust-77a975df85694a4de07abb5f99f1159799b1160d.zip | |
use option_env! instead of env!
| -rw-r--r-- | src/librustc/back/rpath.rs | 4 | ||||
| -rw-r--r-- | src/librustc/driver/driver.rs | 3 | ||||
| -rw-r--r-- | src/librustc/middle/trans/debuginfo.rs | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs index ce79bea5cee..8c0aa494d6f 100644 --- a/src/librustc/back/rpath.rs +++ b/src/librustc/back/rpath.rs @@ -133,7 +133,7 @@ pub fn get_rpath_relative_to_output(os: abi::Os, } pub fn get_install_prefix_rpath(sysroot: &Path, target_triple: &str) -> ~str { - let install_prefix = env!("CFG_PREFIX"); + let install_prefix = option_env!("CFG_PREFIX").expect("CFG_PREFIX"); let tlib = filesearch::relative_target_lib_path(sysroot, target_triple); let mut path = Path::new(install_prefix); @@ -171,7 +171,7 @@ mod test { fn test_prefix_rpath() { let sysroot = filesearch::get_or_default_sysroot(); let res = get_install_prefix_rpath(&sysroot, "triple"); - let mut d = Path::new(env!("CFG_PREFIX")); + let mut d = Path::new((option_env!("CFG_PREFIX")).expect("CFG_PREFIX")); d.push("lib"); d.push(filesearch::rustlibdir()); d.push("triple/lib"); diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index e4ace2a2b95..62ecacd2c3a 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -802,7 +802,8 @@ pub fn host_triple() -> &'static str { // Instead of grabbing the host triple (for the current host), we grab (at // compile time) the target triple that this rustc is built with and // calling that (at runtime) the host triple. - env!("CFG_COMPILER_HOST_TRIPLE") + (option_env!("CFG_COMPILER_HOST_TRIPLE")). + expect("CFG_COMPILER_HOST_TRIPLE") } pub fn build_session_options(matches: &getopts::Matches) -> session::Options { diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 0c7d36e0dbe..6d7c4291fa4 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -984,7 +984,8 @@ fn compile_unit_metadata(cx: &CrateContext) { }; debug!("compile_unit_metadata: {:?}", compile_unit_name); - let producer = format!("rustc version {}", env!("CFG_VERSION")); + let producer = format!("rustc version {}", + (option_env!("CFG_VERSION")).expect("CFG_VERSION")); compile_unit_name.with_ref(|compile_unit_name| { work_dir.as_vec().with_c_str(|work_dir| { |
