Skip to content

Commit 040f984

Browse files
committed
Comment why deps_of doesn't need to keep track of profile_for in map.
1 parent 902cb98 commit 040f984

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ fn deps_of<'a, 'b, 'cfg>(
5252
deps: &'b mut HashMap<Unit<'a>, Vec<Unit<'a>>>,
5353
profile_for: ProfileFor,
5454
) -> CargoResult<&'b [Unit<'a>]> {
55+
// Currently the `deps` map does not include `profile_for`. This should
56+
// be safe for now. `TestDependency` only exists to clear the `panic`
57+
// flag, and you'll never ask for a `unit` with `panic` set as a
58+
// `TestDependency`. `CustomBuild` should also be fine since if the
59+
// requested unit's settings are the same as `Any`, `CustomBuild` can't
60+
// affect anything else in the hierarchy.
5561
if !deps.contains_key(unit) {
5662
let unit_deps = compute_deps(unit, cx, deps, profile_for)?;
5763
let to_insert: Vec<_> = unit_deps.iter().map(|&(unit, _)| unit).collect();

0 commit comments

Comments
 (0)