Skip to content

Commit 26a4ca4

Browse files
committed
don't try to attach roots for non-config'd targets
1 parent 23d8c71 commit 26a4ca4

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/cargo/core/compiler/unit_dependencies.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,19 @@ fn attach_std_deps(
177177
let mut found = false;
178178
for (unit, deps) in state.unit_dependencies.iter_mut() {
179179
if !unit.kind.is_host() && !unit.mode.is_run_custom_build() {
180-
deps.extend(std_roots[&unit.kind].iter().map(|unit| UnitDep {
181-
unit: unit.clone(),
182-
unit_for: UnitFor::new_normal(unit.kind),
183-
extern_crate_name: unit.pkg.name(),
184-
dep_name: None,
185-
// TODO: Does this `public` make sense?
186-
public: true,
187-
noprelude: true,
188-
}));
189-
found = true;
180+
// only attach roots for which the user has requested `build-std` for.
181+
if let Some(roots) = std_roots.get(&unit.kind) {
182+
deps.extend(roots.iter().map(|unit| UnitDep {
183+
unit: unit.clone(),
184+
unit_for: UnitFor::new_normal(unit.kind),
185+
extern_crate_name: unit.pkg.name(),
186+
dep_name: None,
187+
// TODO: Does this `public` make sense?
188+
public: true,
189+
noprelude: true,
190+
}));
191+
found = true;
192+
}
190193
}
191194
}
192195
// And also include the dependencies of the standard library itself. Don't

0 commit comments

Comments
 (0)