@@ -24,7 +24,7 @@ use rustc::ty::layout::{
24
24
25
25
use crate :: interpret:: {
26
26
self , InterpCx , ScalarMaybeUndef , Immediate , OpTy ,
27
- ImmTy , MemoryKind , StackPopCleanup , LocalValue , LocalState ,
27
+ ImmTy , StackPopCleanup , LocalValue , LocalState ,
28
28
} ;
29
29
use crate :: const_eval:: {
30
30
CompileTimeInterpreter , error_to_const_error, mk_eval_cx,
@@ -305,7 +305,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
305
305
let span = source_info. span ;
306
306
match * rvalue {
307
307
Rvalue :: Use ( _) |
308
- Rvalue :: Len ( _) => {
308
+ Rvalue :: Len ( _) |
309
+ Rvalue :: Cast ( ..) => {
309
310
self . use_ecx ( source_info, |this| {
310
311
this. ecx . eval_rvalue_into_place ( rvalue, place) ?;
311
312
this. ecx . eval_place_to_op ( place, Some ( place_layout) )
@@ -321,14 +322,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
321
322
Rvalue :: NullaryOp ( NullOp :: Box , _) |
322
323
Rvalue :: Discriminant ( ..) => None ,
323
324
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
- } ,
332
325
Rvalue :: NullaryOp ( NullOp :: SizeOf , ty) => {
333
326
type_size_of ( self . tcx , self . param_env , ty) . and_then ( |n| Some (
334
327
ImmTy :: from_uint (
0 commit comments