Feature Request: "unstable"/"opt-in"/"non-transitive" crate features

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 crate C, can D pass a K to the function?
  • What if D gives f to B to then call with K?
  • If it can be called, is this passed-in K the same TypeId as C's lookup of K?
  • 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.