@@ -12,7 +12,6 @@ use rustc_middle::mir;
1212use rustc_middle:: mir:: Operand ;
1313use rustc_middle:: ty:: cast:: { CastTy , IntTy } ;
1414use rustc_middle:: ty:: layout:: { HasTyCtxt , LayoutOf } ;
15- use rustc_middle:: ty:: TraitObjectRepresentation ;
1615use rustc_middle:: ty:: { self , adjustment:: PointerCast , Instance , Ty , TyCtxt } ;
1716use rustc_span:: source_map:: { Span , DUMMY_SP } ;
1817
@@ -279,12 +278,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
279278 OperandValue :: Immediate ( v) => v,
280279 OperandValue :: Pair ( _, _) => todo ! ( ) ,
281280 } ;
282- // FIXME: find the real vtable!
283- let trait_ref = if let ty:: Dynamic ( data, _, TraitObjectRepresentation :: Sized ) = cast. ty . kind ( ) {
284- data. principal ( )
285- } else {
286- bug ! ( "Only valid to do a DynStar cast into a DynStar type" )
287- } ;
281+ let trait_ref =
282+ if let ty:: Dynamic ( data, _, ty :: TraitObjectRepresentation :: Sized ) = cast. ty . kind ( ) {
283+ data. principal ( )
284+ } else {
285+ bug ! ( "Only valid to do a DynStar cast into a DynStar type" )
286+ } ;
288287 let vtable = get_vtable ( bx. cx ( ) , source. ty ( self . mir , bx. tcx ( ) ) , trait_ref) ;
289288 OperandValue :: Pair ( data, vtable)
290289 }
0 commit comments