Skip to content

Commit d02c726

Browse files
committed
Store unit dependencies directly into Context
1 parent 42e9412 commit d02c726

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/cargo/core/compiler/context/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
266266
None => None,
267267
};
268268

269-
let deps = build_unit_dependencies(units, self.bcx)?;
270-
self.unit_dependencies = deps;
269+
build_unit_dependencies(units, self.bcx, &mut self.unit_dependencies)?;
271270
let files = CompilationFiles::new(
272271
units,
273272
host_layout,

src/cargo/core/compiler/context/unit_dependencies.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ use CargoResult;
2626
pub fn build_unit_dependencies<'a, 'cfg>(
2727
roots: &[Unit<'a>],
2828
bcx: &BuildContext<'a, 'cfg>,
29-
) -> CargoResult<HashMap<Unit<'a>, Vec<Unit<'a>>>> {
30-
let mut deps = HashMap::new();
29+
mut deps: &mut HashMap<Unit<'a>, Vec<Unit<'a>>>,
30+
) -> CargoResult<()> {
3131
for unit in roots.iter() {
3232
// Dependencies of tests/benches should not have `panic` set.
3333
// We check the global test mode to see if we are running in `cargo
@@ -43,7 +43,7 @@ pub fn build_unit_dependencies<'a, 'cfg>(
4343
deps_of(unit, bcx, &mut deps, profile_for)?;
4444
}
4545

46-
Ok(deps)
46+
Ok(())
4747
}
4848

4949
fn deps_of<'a, 'b, 'cfg>(

0 commit comments

Comments
 (0)