Skip to content

Commit 7e63bc0

Browse files
committed
mir_build: Remove unnecessary lifetime from PatCtxt
It turns out that lifetime `'a` is just `'tcx` in disguise.
1 parent 07a5b02 commit 7e63bc0

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::errors::{
2828
PointerPattern, TypeNotPartialEq, TypeNotStructural, UnionPattern, UnsizedPattern,
2929
};
3030

31-
impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
31+
impl<'tcx> PatCtxt<'tcx> {
3232
/// Converts a constant to a pattern (if possible).
3333
/// This means aggregate values (like structs and enums) are converted
3434
/// to a pattern that matches the value (as if you'd compared via structural equality).
@@ -64,7 +64,7 @@ struct ConstToPat<'tcx> {
6464
}
6565

6666
impl<'tcx> ConstToPat<'tcx> {
67-
fn new(pat_ctxt: &PatCtxt<'_, 'tcx>, id: hir::HirId, span: Span, c: ty::Const<'tcx>) -> Self {
67+
fn new(pat_ctxt: &PatCtxt<'tcx>, id: hir::HirId, span: Span, c: ty::Const<'tcx>) -> Self {
6868
trace!(?pat_ctxt.typeck_results.hir_owner);
6969
ConstToPat { tcx: pat_ctxt.tcx, typing_env: pat_ctxt.typing_env, span, id, c }
7070
}

compiler/rustc_mir_build/src/thir/pattern/mod.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,20 @@ pub(crate) use self::check_match::check_match;
3030
use self::migration::PatMigration;
3131
use crate::errors::*;
3232

33-
struct PatCtxt<'a, 'tcx> {
33+
/// Context for lowering HIR patterns to THIR patterns.
34+
struct PatCtxt<'tcx> {
3435
tcx: TyCtxt<'tcx>,
3536
typing_env: ty::TypingEnv<'tcx>,
36-
typeck_results: &'a ty::TypeckResults<'tcx>,
37+
typeck_results: &'tcx ty::TypeckResults<'tcx>,
3738

3839
/// Used by the Rust 2024 migration lint.
39-
rust_2024_migration: Option<PatMigration<'a>>,
40+
rust_2024_migration: Option<PatMigration<'tcx>>,
4041
}
4142

42-
pub(super) fn pat_from_hir<'a, 'tcx>(
43+
pub(super) fn pat_from_hir<'tcx>(
4344
tcx: TyCtxt<'tcx>,
4445
typing_env: ty::TypingEnv<'tcx>,
45-
typeck_results: &'a ty::TypeckResults<'tcx>,
46+
typeck_results: &'tcx ty::TypeckResults<'tcx>,
4647
pat: &'tcx hir::Pat<'tcx>,
4748
) -> Box<Pat<'tcx>> {
4849
let mut pcx = PatCtxt {
@@ -62,7 +63,7 @@ pub(super) fn pat_from_hir<'a, 'tcx>(
6263
result
6364
}
6465

65-
impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
66+
impl<'tcx> PatCtxt<'tcx> {
6667
fn lower_pattern(&mut self, pat: &'tcx hir::Pat<'tcx>) -> Box<Pat<'tcx>> {
6768
let adjustments: &[PatAdjustment<'tcx>] =
6869
self.typeck_results.pat_adjustments().get(pat.hir_id).map_or(&[], |v| &**v);

0 commit comments

Comments
 (0)