Skip to content

Commit d2210d4

Browse files
Correctly pass --no-default-features when argument is passed
1 parent b87de73 commit d2210d4

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

build_system/src/build.rs

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -107,38 +107,26 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
107107
rustflags.push_str(" -Cpanic=abort -Zpanic-abort-tests");
108108
}
109109
rustflags.push_str(" -Z force-unstable-if-unmarked");
110+
let mut env = env.clone();
111+
112+
let mut args: Vec<&dyn AsRef<OsStr>> = vec![&"cargo", &"build", &"--target", &config.target];
113+
110114
if config.no_default_features {
111115
rustflags.push_str(" -Csymbol-mangling-version=v0");
116+
args.push(&"--no-default-features");
112117
}
113-
let mut env = env.clone();
118+
114119
let channel = if config.sysroot_release_channel {
115-
env.insert(
116-
"RUSTFLAGS".to_string(),
117-
format!("{} -Zmir-opt-level=3", rustflags),
118-
);
119-
run_command_with_output_and_env(
120-
&[
121-
&"cargo",
122-
&"build",
123-
&"--release",
124-
&"--target",
125-
&config.target,
126-
],
127-
Some(start_dir),
128-
Some(&env),
129-
)?;
120+
rustflags.push_str(" -Zmir-opt-level=3");
121+
args.push(&"--release");
130122
"release"
131123
} else {
132-
env.insert("RUSTFLAGS".to_string(), rustflags);
133-
134-
run_command_with_output_and_env(
135-
&[&"cargo", &"build", &"--target", &config.target],
136-
Some(start_dir),
137-
Some(&env),
138-
)?;
139124
"debug"
140125
};
141126

127+
env.insert("RUSTFLAGS".to_string(), rustflags);
128+
run_command_with_output_and_env(&args, Some(start_dir), Some(&env))?;
129+
142130
// Copy files to sysroot
143131
let sysroot_path = start_dir.join(format!("sysroot/lib/rustlib/{}/lib/", config.target_triple));
144132
fs::create_dir_all(&sysroot_path).map_err(|error| {

0 commit comments

Comments
 (0)