Gating API on editions

I'm not seeing how this would help any real-world use cases, unless it's subtly violating the restrictions on edition changes that we need to keep all the editions mutually compatible.

In particular, I doubt we can use this for any trait implementations because that would affect coherence, and in general I think it's ambigous what "the user" of an impl actually is when you consider non-trivial cases like the classic "HashMap problem" with multiple crates and layers of generic code between std and the "user" (does anyone here grok trait/type systems well enough to confirm that?).

Plus, every new std API is already gated on whatever rustc version added it, just like editions are. Do we have any examples of std APIs (that aren't trait impls) that we'd rather gate on an edition than a rustc version? Or where it would matter at all?

3 Likes