Pre-RFC: &[T: Trait] -> &dyn [Trait]
Rust Internals [Unofficial]
April 20, 2026
Using the fake syntax above, you would need something like..
fn same_vtable<T: MyTrait>(a: &dyn MyTrait, b: &dyn MyTrait) -> Option<(&dyn T, &dyn T)> {
// returns None if a and b are actually different types
}
Where the two returned &dyn Ts are just &dyn MyTraits that we know to have the same type T (but we don't know statically what this type is)
The issue with this fake syntax is that this function isn't actually monomorphized for each T so the generics syntax doesn't fit
Discussion in the ATmosphere