@@ -12,7 +12,6 @@ use rustc_middle::mir;
12
12
use rustc_middle:: mir:: Operand ;
13
13
use rustc_middle:: ty:: cast:: { CastTy , IntTy } ;
14
14
use rustc_middle:: ty:: layout:: { HasTyCtxt , LayoutOf } ;
15
- use rustc_middle:: ty:: TraitObjectRepresentation ;
16
15
use rustc_middle:: ty:: { self , adjustment:: PointerCast , Instance , Ty , TyCtxt } ;
17
16
use rustc_span:: source_map:: { Span , DUMMY_SP } ;
18
17
@@ -279,12 +278,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
279
278
OperandValue :: Immediate ( v) => v,
280
279
OperandValue :: Pair ( _, _) => todo ! ( ) ,
281
280
} ;
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
+ } ;
288
287
let vtable = get_vtable ( bx. cx ( ) , source. ty ( self . mir , bx. tcx ( ) ) , trait_ref) ;
289
288
OperandValue :: Pair ( data, vtable)
290
289
}
0 commit comments