Skip to content

Commit 85ce626

Browse files
committed
Improve PlaceElem::Subslice handling
1 parent ddd3d95 commit 85ce626

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/base.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -678,11 +678,10 @@ pub fn trans_place<'tcx>(
678678
// slice[from:-to] in Python terms.
679679

680680
match cplace.layout().ty.kind {
681-
ty::Array(elem_ty, len) => {
681+
ty::Array(elem_ty, _len) => {
682+
assert!(!from_end, "array subslices are never `from_end`");
682683
let elem_layout = fx.layout_of(elem_ty);
683684
let ptr = cplace.to_ptr(fx);
684-
let len = crate::constant::force_eval_const(fx, len)
685-
.eval_usize(fx.tcx, ParamEnv::reveal_all());
686685
cplace = CPlace::for_ptr(
687686
ptr.offset_i64(fx, elem_layout.size.bytes() as i64 * from as i64),
688687
fx.layout_of(fx.tcx.mk_array(elem_ty, to as u64 - from as u64)),

0 commit comments

Comments
 (0)