Skip to content

Commit fa4f269

Browse files
committed
Fix the build-std check in cargo-espflash, as it currently ignores command-line arguments
1 parent 125a252 commit fa4f269

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

cargo-espflash/src/main.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,18 @@ fn build(
268268
}
269269

270270
// The 'build-std' unstable cargo feature is required to enable
271-
// cross-compilation for xtensa targets.
272-
// If it has not been set then we cannot build the
273-
// application.
274-
if !cargo_config.has_build_std() && target.starts_with("xtensa-") {
271+
// cross-compilation for Xtensa targets. If it has not been set then we
272+
// cannot build the application, and the cause of the (numerous) build errors
273+
// may not be immediately clear to the user.
274+
let cfg_has_build_std = cargo_config.has_build_std();
275+
let opts_has_build_std = build_options
276+
.clone()
277+
.unstable
278+
.map(|ref v| v.iter().any(|s| s.contains("build-std")))
279+
.unwrap_or_default();
280+
let xtensa_target = target.starts_with("xtensa-");
281+
282+
if xtensa_target && !(cfg_has_build_std || opts_has_build_std) {
275283
return Err(Error::NoBuildStd.into());
276284
};
277285

0 commit comments

Comments
 (0)