From 457c2db1a04883b64f21a1dda206ce93eddc716a Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Sat, 30 Jul 2022 16:05:48 +0200 Subject: [PATCH] Work around https://github.com/rust-lang/cargo/issues/4423 - `cargo auditable` no longer breaks compilation of proc macros --- cargo-auditable/src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cargo-auditable/src/main.rs b/cargo-auditable/src/main.rs index 42b2ac4..752c1ea 100644 --- a/cargo-auditable/src/main.rs +++ b/cargo-auditable/src/main.rs @@ -44,6 +44,12 @@ fn cargo_command(cargo_auditable_args: &Subcommand) -> Command { for arg in cargo_auditable_args.args() { command.arg(arg); } + // Work around https://github.com/rust-lang/cargo/issues/4423 by explicitly passing the host platform if not already specified. + // Otherwise proc macros will fail to build. Sadly this changes the output directory, which is one hell of a footgun! + // TODO: either prevent the change to the output dir, or make it so different and obvious that it's not confusing anymore. + if cargo_auditable_args.target().is_none() { + command.arg(format!("--target={}", cargo_auditable_args.host_triple())); + } command }