mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 09:53:04 +03:00
16da3ab2ea
Do not require `'static` for obtaining reflection information. tracking issue rust-lang/rust#142577 This does not affect the stable `TypeId::of`, as that has its own `'static` bound. But it will allow obtaining `TypeId`s for non-static types via the reflection API. To obtain such a `TypeId` for any type, just use `Type::of::<(T,)>().kind` to extract the first field of a tuple. This effectively reintroduces rust-lang/rust#41875, which @rust-lang/lang decided against allowing back in 2018 due to lack of sound use cases. We will thus need to have a T-lang meeting specifically about `TypeId` for non-static types before *stabilizing* any part of reflection (in addition to T-lang meetings about reflection in general). I'm adding an explicit point about this to the tracking issue. cc @scottmcm @joshtriplett @9SonSteroids @SpriteOvO @izagawd @BD103