mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 12:13:43 +00:00
use option_env! instead of env!
This commit is contained in:
parent
7d70434a1e
commit
77a975df85
@ -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");
|
||||
|
@ -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 {
|
||||
|
@ -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| {
|
||||
|
Loading…
Reference in New Issue
Block a user