Skip to content

Commit b91a98b

Browse files
Even more
1 parent eebb2ab commit b91a98b

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

compiler/rustc_pattern_analysis/src/rustc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl<'p, 'tcx> RustcMatchCheckCtxt<'p, 'tcx> {
131131
pub(crate) fn list_variant_nonhidden_fields<'a>(
132132
&'a self,
133133
ty: Ty<'tcx>,
134-
variant: &'a VariantDef,
134+
variant: &'a VariantDef, // TODO:
135135
) -> impl Iterator<Item = (FieldIdx, Ty<'tcx>)> + Captures<'p> + Captures<'a> {
136136
let cx = self;
137137
let ty::Adt(adt, args) = ty.kind() else { bug!() };

compiler/rustc_pattern_analysis/src/usefulness.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,6 @@ impl fmt::Display for ValidityConstraint {
821821

822822
/// Represents a pattern-tuple under investigation.
823823
// The three lifetimes are:
824-
// - 'a allocated by us
825824
// - 'p coming from the input
826825
// - Cx global compilation context
827826
#[derive(derivative::Derivative)]
@@ -835,7 +834,7 @@ struct PatStack<'p, Cx: TypeCx> {
835834
relevant: bool,
836835
}
837836

838-
impl<'a, 'p, Cx: TypeCx> PatStack<'p, Cx> {
837+
impl<'p, Cx: TypeCx> PatStack<'p, Cx> {
839838
fn from_pattern(pat: &'p DeconstructedPat<'p, Cx>) -> Self {
840839
PatStack { pats: smallvec![pat], relevant: true }
841840
}
@@ -870,7 +869,7 @@ impl<'a, 'p, Cx: TypeCx> PatStack<'p, Cx> {
870869
/// Only call if `ctor.is_covered_by(self.head().ctor())` is true.
871870
fn pop_head_constructor(
872871
&self,
873-
pcx: &PlaceCtxt<'a, 'p, Cx>,
872+
pcx: &PlaceCtxt<'_, 'p, Cx>,
874873
ctor: &Constructor<Cx>,
875874
ctor_is_relevant: bool,
876875
) -> PatStack<'p, Cx> {
@@ -914,7 +913,7 @@ struct MatrixRow<'p, Cx: TypeCx> {
914913
useful: bool,
915914
}
916915

917-
impl<'a, 'p, Cx: TypeCx> MatrixRow<'p, Cx> {
916+
impl<'p, Cx: TypeCx> MatrixRow<'p, Cx> {
918917
fn is_empty(&self) -> bool {
919918
self.pats.is_empty()
920919
}
@@ -946,7 +945,7 @@ impl<'a, 'p, Cx: TypeCx> MatrixRow<'p, Cx> {
946945
/// Only call if `ctor.is_covered_by(self.head().ctor())` is true.
947946
fn pop_head_constructor(
948947
&self,
949-
pcx: &PlaceCtxt<'a, 'p, Cx>,
948+
pcx: &PlaceCtxt<'_, 'p, Cx>,
950949
ctor: &Constructor<Cx>,
951950
ctor_is_relevant: bool,
952951
parent_row: usize,
@@ -989,7 +988,7 @@ struct Matrix<'p, Cx: TypeCx> {
989988
place_validity: SmallVec<[ValidityConstraint; 2]>,
990989
}
991990

992-
impl<'a, 'p, Cx: TypeCx> Matrix<'p, Cx> {
991+
impl<'p, Cx: TypeCx> Matrix<'p, Cx> {
993992
/// Pushes a new row to the matrix. If the row starts with an or-pattern, this recursively
994993
/// expands it. Internal method, prefer [`Matrix::new`].
995994
fn expand_and_push(&mut self, row: MatrixRow<'p, Cx>) {
@@ -1006,7 +1005,7 @@ impl<'a, 'p, Cx: TypeCx> Matrix<'p, Cx> {
10061005
/// Build a new matrix from an iterator of `MatchArm`s.
10071006
fn new(
10081007
wildcard_arena: &'p TypedArena<DeconstructedPat<'p, Cx>>,
1009-
arms: &'a [MatchArm<'p, Cx>],
1008+
arms: &[MatchArm<'p, Cx>],
10101009
scrut_ty: Cx::Ty,
10111010
scrut_validity: ValidityConstraint,
10121011
) -> Self {
@@ -1029,7 +1028,7 @@ impl<'a, 'p, Cx: TypeCx> Matrix<'p, Cx> {
10291028
matrix
10301029
}
10311030

1032-
fn head_ty(&self, mcx: MatchCtxt<'a, 'p, Cx>) -> Option<Cx::Ty> {
1031+
fn head_ty(&self, mcx: MatchCtxt<'_, 'p, Cx>) -> Option<Cx::Ty> {
10331032
if self.column_count() == 0 {
10341033
return None;
10351034
}
@@ -1056,16 +1055,14 @@ impl<'a, 'p, Cx: TypeCx> Matrix<'p, Cx> {
10561055
}
10571056

10581057
/// Iterate over the first pattern of each row.
1059-
fn heads<'b>(
1060-
&'b self,
1061-
) -> impl Iterator<Item = &'b DeconstructedPat<'p, Cx>> + Clone + Captures<'a> {
1058+
fn heads<'b>(&'b self) -> impl Iterator<Item = &'b DeconstructedPat<'p, Cx>> + Clone {
10621059
self.rows().map(|r| r.head())
10631060
}
10641061

10651062
/// This computes `specialize(ctor, self)`. See top of the file for explanations.
10661063
fn specialize_constructor(
10671064
&self,
1068-
pcx: &PlaceCtxt<'a, 'p, Cx>,
1065+
pcx: &PlaceCtxt<'_, 'p, Cx>,
10691066
ctor: &Constructor<Cx>,
10701067
ctor_is_relevant: bool,
10711068
) -> Matrix<'p, Cx> {

0 commit comments

Comments
 (0)