From: Eric Huss Date: Tue, 24 Apr 2018 17:35:20 +0000 (-0700) Subject: Comment why `deps_of` doesn't need to keep track of `profile_for` in map. X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~41^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=040f9849dce936a16dcba73ba543e41d147af943;p=cargo.git Comment why `deps_of` doesn't need to keep track of `profile_for` in map. --- diff --git a/src/cargo/core/compiler/context/unit_dependencies.rs b/src/cargo/core/compiler/context/unit_dependencies.rs index e5fdcb523..84ee755b7 100644 --- a/src/cargo/core/compiler/context/unit_dependencies.rs +++ b/src/cargo/core/compiler/context/unit_dependencies.rs @@ -52,6 +52,12 @@ fn deps_of<'a, 'b, 'cfg>( deps: &'b mut HashMap, Vec>>, profile_for: ProfileFor, ) -> CargoResult<&'b [Unit<'a>]> { + // Currently the `deps` map does not include `profile_for`. This should + // be safe for now. `TestDependency` only exists to clear the `panic` + // flag, and you'll never ask for a `unit` with `panic` set as a + // `TestDependency`. `CustomBuild` should also be fine since if the + // requested unit's settings are the same as `Any`, `CustomBuild` can't + // affect anything else in the hierarchy. if !deps.contains_key(unit) { let unit_deps = compute_deps(unit, cx, deps, profile_for)?; let to_insert: Vec<_> = unit_deps.iter().map(|&(unit, _)| unit).collect();