From 85ce626865d589e817b6753467dc5d8593454e6c Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 18 Jan 2020 10:23:51 +0100 Subject: [PATCH] Improve PlaceElem::Subslice handling --- src/base.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/base.rs b/src/base.rs index 5eb0170a19d..e1ca09fa780 100644 --- a/src/base.rs +++ b/src/base.rs @@ -678,11 +678,10 @@ pub fn trans_place<'tcx>( // slice[from:-to] in Python terms. match cplace.layout().ty.kind { - ty::Array(elem_ty, len) => { + ty::Array(elem_ty, _len) => { + assert!(!from_end, "array subslices are never `from_end`"); let elem_layout = fx.layout_of(elem_ty); let ptr = cplace.to_ptr(fx); - let len = crate::constant::force_eval_const(fx, len) - .eval_usize(fx.tcx, ParamEnv::reveal_all()); cplace = CPlace::for_ptr( ptr.offset_i64(fx, elem_layout.size.bytes() as i64 * from as i64), fx.layout_of(fx.tcx.mk_array(elem_ty, to as u64 - from as u64)),