@@ -19,7 +19,7 @@ use syntax_pos::{Span, DUMMY_SP};
1919use rustc:: ty:: subst:: InternalSubsts ;
2020use rustc_data_structures:: indexed_vec:: IndexVec ;
2121use rustc:: ty:: layout:: {
22- LayoutOf , TyLayout , LayoutError , HasTyCtxt , TargetDataLayout , HasDataLayout , Size ,
22+ LayoutOf , TyLayout , LayoutError , HasTyCtxt , TargetDataLayout , HasDataLayout ,
2323} ;
2424
2525use crate :: interpret:: {
@@ -396,30 +396,21 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
396396 if let ty:: Slice ( _) = mplace. layout . ty . sty {
397397 let len = mplace. meta . unwrap ( ) . to_usize ( & self . ecx ) . unwrap ( ) ;
398398
399- Some ( ImmTy {
400- imm : Immediate :: Scalar (
401- Scalar :: from_uint (
402- len,
403- Size :: from_bits (
404- self . tcx . sess . target . usize_ty . bit_width ( ) . unwrap ( ) as u64
405- )
406- ) . into ( ) ,
407- ) ,
408- layout : self . tcx . layout_of ( self . param_env . and ( self . tcx . types . usize ) ) . ok ( ) ?,
409- } . into ( ) )
399+ Some ( ImmTy :: from_uint (
400+ len,
401+ self . tcx . layout_of ( self . param_env . and ( self . tcx . types . usize ) ) . ok ( ) ?,
402+ ) . into ( ) )
410403 } else {
411404 trace ! ( "not slice: {:?}" , mplace. layout. ty. sty) ;
412405 None
413406 }
414407 } ,
415408 Rvalue :: NullaryOp ( NullOp :: SizeOf , ty) => {
416409 type_size_of ( self . tcx , self . param_env , ty) . and_then ( |n| Some (
417- ImmTy {
418- imm : Immediate :: Scalar (
419- Scalar :: from_uint ( n, self . tcx . data_layout . pointer_size ) . into ( )
420- ) ,
421- layout : self . tcx . layout_of ( self . param_env . and ( self . tcx . types . usize ) ) . ok ( ) ?,
422- } . into ( )
410+ ImmTy :: from_uint (
411+ n,
412+ self . tcx . layout_of ( self . param_env . and ( self . tcx . types . usize ) ) . ok ( ) ?,
413+ ) . into ( )
423414 ) )
424415 }
425416 Rvalue :: UnaryOp ( op, ref arg) => {
0 commit comments