@@ -24,7 +24,7 @@ use rustc::ty::layout::{
2424
2525use crate :: interpret:: {
2626 self , InterpCx , ScalarMaybeUndef , Immediate , OpTy ,
27- ImmTy , MemoryKind , StackPopCleanup , LocalValue , LocalState ,
27+ ImmTy , StackPopCleanup , LocalValue , LocalState ,
2828} ;
2929use crate :: const_eval:: {
3030 CompileTimeInterpreter , error_to_const_error, mk_eval_cx,
@@ -305,7 +305,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
305305 let span = source_info. span ;
306306 match * rvalue {
307307 Rvalue :: Use ( _) |
308- Rvalue :: Len ( _) => {
308+ Rvalue :: Len ( _) |
309+ Rvalue :: Cast ( ..) => {
309310 self . use_ecx ( source_info, |this| {
310311 this. ecx . eval_rvalue_into_place ( rvalue, place) ?;
311312 this. ecx . eval_place_to_op ( place, Some ( place_layout) )
@@ -321,14 +322,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
321322 Rvalue :: NullaryOp ( NullOp :: Box , _) |
322323 Rvalue :: Discriminant ( ..) => None ,
323324
324- Rvalue :: Cast ( kind, ref operand, _) => {
325- let op = self . eval_operand ( operand, source_info) ?;
326- self . use_ecx ( source_info, |this| {
327- let dest = this. ecx . allocate ( place_layout, MemoryKind :: Stack ) ;
328- this. ecx . cast ( op, kind, dest. into ( ) ) ?;
329- Ok ( dest. into ( ) )
330- } )
331- } ,
332325 Rvalue :: NullaryOp ( NullOp :: SizeOf , ty) => {
333326 type_size_of ( self . tcx , self . param_env , ty) . and_then ( |n| Some (
334327 ImmTy :: from_uint (
0 commit comments