Skip to content

Commit af28115

Browse files
committed
experiment with place code
1 parent 2e5f68c commit af28115

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

compiler/rustc_mir_build/src/builder/matches/match_pair.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
129129
&mut self,
130130
base_pat: &'pat Pat<'tcx>,
131131
match_pairs: &mut Vec<MatchPairTree<'pat, 'tcx>>,
132-
place: &PlaceBuilder<'tcx>,
132+
place: PlaceBuilder<'tcx>,
133133
prefix: &'pat [Box<Pat<'tcx>>],
134134
opt_slice: &'pat Option<Box<Pat<'tcx>>>,
135135
suffix: &'pat [Box<Pat<'tcx>>],
@@ -158,13 +158,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
158158
if self.is_constant_pattern_subslice(prefix) {
159159
let elem_ty = prefix[0].ty;
160160
let prefix_valtree = self.simplify_const_pattern_slice_into_valtree(prefix);
161-
// FIXME(jieyouxu): triple check these place calculations!
161+
let elem =
162+
ProjectionElem::Subslice { from: 0, to: prefix.len() as u64, from_end: false };
162163
if let Some(match_pair) = self.valtree_to_match_pair(
163164
base_pat.ty,
164165
base_pat.span,
165166
prefix.len() as u64,
166167
prefix_valtree,
167-
place.base().into(),
168+
place.clone_project(elem),
168169
elem_ty,
169170
) {
170171
match_pairs.push(match_pair);
@@ -318,7 +319,7 @@ impl<'pat, 'tcx> MatchPairTree<'pat, 'tcx> {
318319
cx.prefix_slice_suffix(
319320
pattern,
320321
&mut subpairs,
321-
&place_builder,
322+
place_builder,
322323
prefix,
323324
slice,
324325
suffix,
@@ -329,7 +330,7 @@ impl<'pat, 'tcx> MatchPairTree<'pat, 'tcx> {
329330
cx.prefix_slice_suffix(
330331
pattern,
331332
&mut subpairs,
332-
&place_builder,
333+
place_builder,
333334
prefix,
334335
slice,
335336
suffix,

0 commit comments

Comments
 (0)