@@ -1028,7 +1028,7 @@ impl ProjectionElem {
1028
1028
ProjectionElem::Field(_idx, fty) => Ok(*fty),
1029
1029
ProjectionElem::Index(_) | ProjectionElem::ConstantIndex { .. } => Self::index_ty(ty),
1030
1030
ProjectionElem::Subslice { from, to, from_end } => {
1031
- Self::subslice_ty(ty, from, to, from_end)
1031
+ Self::subslice_ty(ty, * from, * to, * from_end)
1032
1032
}
1033
1033
ProjectionElem::Downcast(_) => Ok(ty),
1034
1034
ProjectionElem::OpaqueCast(ty) | ProjectionElem::Subtype(ty) => Ok(*ty),
@@ -1039,13 +1039,13 @@ impl ProjectionElem {
1039
1039
ty.kind().builtin_index().ok_or_else(|| error!("Cannot index non-array type: {ty:?}"))
1040
1040
}
1041
1041
1042
- fn subslice_ty(ty: Ty, from: & u64, to: & u64, from_end: & bool) -> Result<Ty, Error> {
1042
+ fn subslice_ty(ty: Ty, from: u64, to: u64, from_end: bool) -> Result<Ty, Error> {
1043
1043
let ty_kind = ty.kind();
1044
1044
match ty_kind {
1045
1045
TyKind::RigidTy(RigidTy::Slice(..)) => Ok(ty),
1046
1046
TyKind::RigidTy(RigidTy::Array(inner, _)) if !from_end => Ty::try_new_array(
1047
1047
inner,
1048
- to.checked_sub(* from).ok_or_else(|| error!("Subslice overflow: {from}..{to}"))?,
1048
+ to.checked_sub(from).ok_or_else(|| error!("Subslice overflow: {from}..{to}"))?,
1049
1049
),
1050
1050
TyKind::RigidTy(RigidTy::Array(inner, size)) => {
1051
1051
let size = size.eval_target_usize()?;
0 commit comments