Skip to content

Commit e89e468

Browse files
committed
Move the cargo add runtime to before any other cargo commands so that they work correctly always.
1 parent bc2931f commit e89e468

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

dynamic_instrumentation/src/main.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,6 @@ fn cargo_wrapper(rustc_wrapper: &Path) -> anyhow::Result<()> {
228228

229229
let cargo = Cargo::new();
230230

231-
let cargo_metadata = cargo.metadata().exec()?;
232-
let root_package = cargo_metadata
233-
.root_package()
234-
.ok_or_else(|| anyhow!("no root package found by `cargo`"))?;
235-
236-
cargo.run(|cmd| {
237-
cmd.args(&["clean", "--package", root_package.name.as_str()]);
238-
})?;
239-
240231
// TODO(kkysen) Once we upgrade to 1.62, we can just use `cargo` and not specify `+stable`.
241232
// The problem currently is that `+stable` doesn't work on a resolved `$CARGO`,
242233
// which happens when this runs inside of `cargo test`,
@@ -254,6 +245,15 @@ fn cargo_wrapper(rustc_wrapper: &Path) -> anyhow::Result<()> {
254245
}
255246
})?;
256247

248+
let cargo_metadata = cargo.metadata().exec()?;
249+
let root_package = cargo_metadata
250+
.root_package()
251+
.ok_or_else(|| anyhow!("no root package found by `cargo`"))?;
252+
253+
cargo.run(|cmd| {
254+
cmd.args(&["clean", "--package", root_package.name.as_str()]);
255+
})?;
256+
257257
cargo.run(|cmd| {
258258
add_runtime_feature(&mut cargo_args);
259259
cmd.args(cargo_args)

0 commit comments

Comments
 (0)