Skip to content

Commit

Permalink
Add -Clink-dead-code to metadata gen RUSTFLAGS (#1344)
Browse files Browse the repository at this point in the history
* Add `-Clink-dead-code` to metadata gen RUSTFLAGS

* Don't link-dead-code on windows
  • Loading branch information
ascjones authored Sep 27, 2023
1 parent bba9c0c commit 19262f6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/build/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,20 @@ pub fn execute(
network.append_to_args(&mut args);
features.append_to_args(&mut args);

#[cfg(windows)]
let link_dead_code = "";

#[cfg(not(windows))]
let link_dead_code = "\x1f-Clink-dead-code";

let cmd = util::cargo_cmd(
"run",
args,
crate_metadata.manifest_path.directory(),
verbosity,
vec![(
"CARGO_ENCODED_RUSTFLAGS",
Some("--cap-lints=allow".to_string()),
Some(format!("--cap-lints=allow{link_dead_code}")),
)],
);
let output = cmd.stdout_capture().run()?;
Expand Down

0 comments on commit 19262f6

Please sign in to comment.