use rustc_middle::ty;
use rustc_middle::ty::TypeVisitable;
use smallvec::SmallVec;
-use std::convert::TryInto;
impl<'a, 'tcx> Builder<'a, 'tcx> {
pub(crate) fn field_match_pairs<'pat>(
subpatterns
.iter()
.map(|fieldpat| {
- let place = place.clone().field(fieldpat.field, fieldpat.pattern.ty);
+ let place =
+ place.clone_project(PlaceElem::Field(fieldpat.field, fieldpat.pattern.ty));
MatchPair::new(place, &fieldpat.pattern, self)
})
.collect()
match_pairs.extend(prefix.iter().enumerate().map(|(idx, subpattern)| {
let elem =
ProjectionElem::ConstantIndex { offset: idx as u64, min_length, from_end: false };
- let place = place.clone().project(elem);
- MatchPair::new(place, subpattern, self)
+ MatchPair::new(place.clone_project(elem), subpattern, self)
}));
if let Some(subslice_pat) = opt_slice {
let suffix_len = suffix.len() as u64;
- let subslice = place.clone().project(ProjectionElem::Subslice {
+ let subslice = place.clone_project(PlaceElem::Subslice {
from: prefix.len() as u64,
to: if exact_size { min_length - suffix_len } else { suffix_len },
from_end: !exact_size,
min_length,
from_end: !exact_size,
};
- let place = place.clone().project(elem);
+ let place = place.clone_project(elem);
MatchPair::new(place, subpattern, self)
}));
}