Pre-RFC: non-footgun non-static TypeId

I haven’t thought too deeply about how much of a problem this is, but a potential remaining concern with the API you’re proposing is that a type like

struct Foo(&'static str);

could be changed into

struct Foo<T = &'static str>(T);

with the intention of this being a non-breaking change, however this changes the behavior of

intrinsics::all_types_with_this_id_are_static::<Foo>()

from true to false, and thus breaks use-cases of type_id.same_as::<Foo>().

4 Likes