diff --git a/src/cargo/core/compiler/artifact.rs b/src/cargo/core/compiler/artifact.rs
index 04947a4244a..4042bba1ba8 100644
--- a/src/cargo/core/compiler/artifact.rs
+++ b/src/cargo/core/compiler/artifact.rs
@@ -1,9 +1,9 @@
use crate::core::compiler::unit_graph::UnitDep;
-use crate::core::compiler::{Context, CrateType, FileFlavor, Unit};
+use crate::core::compiler::{Context, CrateType, FileFlavor, Metadata, Unit};
use crate::core::TargetKind;
use crate::CargoResult;
use cargo_util::ProcessBuilder;
-use std::collections::HashSet;
+use std::collections::{HashMap, HashSet};
use std::path::PathBuf;
/// Adjust `cmd` to contain artifact environment variables and return all set key/value pairs for later use.
@@ -11,9 +11,10 @@ pub fn set_env(
cx: &Context<'_, '_>,
dependencies: &[UnitDep],
cmd: &mut ProcessBuilder,
-) -> CargoResult