Non-transitive has a problem with impl Trait for N
. Let's say there are crates A, B, C, and D. A provides some type K with an impl SomeTrait
behind a feature flag. B requests the feature of A, C does not, and D uses A (with the feature), B, and C. If there is a function f
(in any crate) that has a T: SomeTrait
bound.
Questions:
- If
f
is in crateC
, canD
pass aK
to the function? - What if
D
givesf
toB
to then call withK
? - If it can be called, is this passed-in
K
the same TypeId asC
's lookup ofK
? - If it cannot be called, what kinds of error messages would make any sense when this happens?
I think hiding names (anything you can name with use
) behind "you didn't ask for this feature" is fine, but acting as if the feature is completely gone is not feasible. You cannot hide an impl
behind a use
statement (i.e., it is global state), so it cannot be hidden by such feature flag logic.