@@ -2,7 +2,7 @@ use std::convert::TryFrom;
22
33use crate :: mir:: interpret:: { alloc_range, AllocId , Allocation , Pointer , Scalar , ScalarMaybeUninit } ;
44use crate :: ty:: fold:: TypeFoldable ;
5- use crate :: ty:: { self , DefId , SubstsRef , Ty , TyCtxt } ;
5+ use crate :: ty:: { self , DefId , PolyExistentialTraitRef , SubstsRef , Ty , TyCtxt } ;
66use rustc_ast:: Mutability ;
77
88#[ derive( Clone , Copy , Debug , PartialEq , HashStable ) ]
@@ -12,6 +12,7 @@ pub enum VtblEntry<'tcx> {
1212 MetadataAlign ,
1313 Vacant ,
1414 Method ( DefId , SubstsRef < ' tcx > ) ,
15+ TraitVPtr ( PolyExistentialTraitRef < ' tcx > ) ,
1516}
1617
1718pub const COMMON_VTABLE_ENTRIES : & [ VtblEntry < ' _ > ] =
@@ -92,6 +93,11 @@ impl<'tcx> TyCtxt<'tcx> {
9293 let fn_ptr = Pointer :: from ( fn_alloc_id) ;
9394 ScalarMaybeUninit :: from_pointer ( fn_ptr, & tcx)
9495 }
96+ VtblEntry :: TraitVPtr ( trait_ref) => {
97+ let supertrait_alloc_id = self . vtable_allocation ( ty, Some ( * trait_ref) ) ;
98+ let vptr = Pointer :: from ( supertrait_alloc_id) ;
99+ ScalarMaybeUninit :: from_pointer ( vptr, & tcx)
100+ }
95101 } ;
96102 vtable
97103 . write_scalar ( & tcx, alloc_range ( ptr_size * idx, ptr_size) , scalar)
0 commit comments