Skip to content

Commit 455095a

Browse files
committed
Remove unneeded lifetime extensions
1 parent 1f6a5a5 commit 455095a

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

src/librustc_mir/hair/pattern/_match.rs

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -363,26 +363,23 @@ impl<'p, 'tcx> PatStack<'p, 'tcx> {
363363
self.0.len()
364364
}
365365

366-
fn head<'a, 'p2>(&'a self) -> &'p2 Pat<'tcx>
367-
where
368-
'p: 'p2,
369-
{
366+
fn head<'a>(&'a self) -> &'p Pat<'tcx> {
370367
self.0[0]
371368
}
372369
fn iter(&self) -> impl Iterator<Item = &Pat<'tcx>> {
373370
self.0.iter().map(|p| *p)
374371
}
375372

376373
/// This computes `S(constructor, self)`. See top of the file for explanations.
377-
fn specialize<'a, 'p2>(
374+
fn specialize<'a, 'q>(
378375
&self,
379376
cx: &MatchCheckCtxt<'a, 'tcx>,
380377
constructor: &Constructor<'tcx>,
381-
ctor_wild_subpatterns: &[&'p2 Pat<'tcx>],
382-
) -> SmallVec<[PatStack<'p2, 'tcx>; 1]>
378+
ctor_wild_subpatterns: &[&'q Pat<'tcx>],
379+
) -> SmallVec<[PatStack<'q, 'tcx>; 1]>
383380
where
384-
'a: 'p2,
385-
'p: 'p2,
381+
'a: 'q,
382+
'p: 'q,
386383
{
387384
let new_heads = specialize_one_pattern(cx, self.head(), constructor, ctor_wild_subpatterns);
388385
let result = new_heads
@@ -426,29 +423,25 @@ impl<'p, 'tcx> Matrix<'p, 'tcx> {
426423

427424
/// Iterate over the first component of each row
428425
// Can't return impl Iterator because of hidden lifetime capture.
429-
fn heads<'a, 'p2>(
426+
fn heads<'a>(
430427
&'a self,
431428
) -> iter::Map<
432429
std::slice::Iter<'a, PatStack<'p, 'tcx>>,
433-
impl FnMut(&'a PatStack<'p, 'tcx>) -> &'p2 Pat<'tcx>,
434-
>
435-
where
436-
'p: 'p2,
437-
'a: 'p2,
438-
{
430+
impl FnMut(&'a PatStack<'p, 'tcx>) -> &'p Pat<'tcx>,
431+
> {
439432
self.0.iter().map(|r| r.head())
440433
}
441434

442435
/// This computes `S(constructor, self)`. See top of the file for explanations.
443-
fn specialize<'a, 'p2>(
436+
fn specialize<'a, 'q>(
444437
&self,
445438
cx: &MatchCheckCtxt<'a, 'tcx>,
446439
constructor: &Constructor<'tcx>,
447-
ctor_wild_subpatterns: &[&'p2 Pat<'tcx>],
448-
) -> Matrix<'p2, 'tcx>
440+
ctor_wild_subpatterns: &[&'q Pat<'tcx>],
441+
) -> Matrix<'q, 'tcx>
449442
where
450-
'a: 'p2,
451-
'p: 'p2,
443+
'a: 'q,
444+
'p: 'q,
452445
{
453446
Matrix(
454447
self.0
@@ -2013,9 +2006,9 @@ fn patterns_for_variant<'p, 'tcx>(
20132006
///
20142007
/// Structure patterns with a partial wild pattern (Foo { a: 42, .. }) have their missing
20152008
/// fields filled with wild patterns.
2016-
fn specialize_one_pattern<'p, 'a: 'p, 'p2: 'p, 'tcx>(
2009+
fn specialize_one_pattern<'p, 'a: 'p, 'q: 'p, 'tcx>(
20172010
cx: &MatchCheckCtxt<'a, 'tcx>,
2018-
mut pat: &'p2 Pat<'tcx>,
2011+
mut pat: &'q Pat<'tcx>,
20192012
constructor: &Constructor<'tcx>,
20202013
ctor_wild_subpatterns: &[&'p Pat<'tcx>],
20212014
) -> SmallVec<[PatStack<'p, 'tcx>; 1]> {

0 commit comments

Comments
 (0)