Skip to content

Commit 48d089a

Browse files
Merge 'thir and 'p
1 parent 2b4f84f commit 48d089a

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

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

+17-17
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ enum LetSource {
7575
WhileLet,
7676
}
7777

78-
struct MatchVisitor<'thir, 'p, 'tcx> {
78+
struct MatchVisitor<'p, 'tcx> {
7979
tcx: TyCtxt<'tcx>,
8080
param_env: ty::ParamEnv<'tcx>,
8181
typeck_results: &'tcx ty::TypeckResults<'tcx>,
82-
thir: &'thir Thir<'tcx>,
82+
thir: &'p Thir<'tcx>,
8383
lint_level: HirId,
8484
let_source: LetSource,
8585
pattern_arena: &'p TypedArena<DeconstructedPat<'p, 'tcx>>,
@@ -92,13 +92,13 @@ struct MatchVisitor<'thir, 'p, 'tcx> {
9292

9393
// Visitor for a thir body. This calls `check_match`, `check_let` and `check_let_chain` as
9494
// appropriate.
95-
impl<'thir, 'tcx> Visitor<'thir, 'tcx> for MatchVisitor<'thir, '_, 'tcx> {
96-
fn thir(&self) -> &'thir Thir<'tcx> {
95+
impl<'p, 'tcx> Visitor<'p, 'tcx> for MatchVisitor<'p, 'tcx> {
96+
fn thir(&self) -> &'p Thir<'tcx> {
9797
self.thir
9898
}
9999

100100
#[instrument(level = "trace", skip(self))]
101-
fn visit_arm(&mut self, arm: &'thir Arm<'tcx>) {
101+
fn visit_arm(&mut self, arm: &'p Arm<'tcx>) {
102102
self.with_lint_level(arm.lint_level, |this| {
103103
match arm.guard {
104104
Some(Guard::If(expr)) => {
@@ -121,7 +121,7 @@ impl<'thir, 'tcx> Visitor<'thir, 'tcx> for MatchVisitor<'thir, '_, 'tcx> {
121121
}
122122

123123
#[instrument(level = "trace", skip(self))]
124-
fn visit_expr(&mut self, ex: &'thir Expr<'tcx>) {
124+
fn visit_expr(&mut self, ex: &'p Expr<'tcx>) {
125125
match ex.kind {
126126
ExprKind::Scope { value, lint_level, .. } => {
127127
self.with_lint_level(lint_level, |this| {
@@ -174,7 +174,7 @@ impl<'thir, 'tcx> Visitor<'thir, 'tcx> for MatchVisitor<'thir, '_, 'tcx> {
174174
self.with_let_source(LetSource::None, |this| visit::walk_expr(this, ex));
175175
}
176176

177-
fn visit_stmt(&mut self, stmt: &'thir Stmt<'tcx>) {
177+
fn visit_stmt(&mut self, stmt: &'p Stmt<'tcx>) {
178178
match stmt.kind {
179179
StmtKind::Let {
180180
box ref pattern, initializer, else_block, lint_level, span, ..
@@ -195,7 +195,7 @@ impl<'thir, 'tcx> Visitor<'thir, 'tcx> for MatchVisitor<'thir, '_, 'tcx> {
195195
}
196196
}
197197

198-
impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
198+
impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
199199
#[instrument(level = "trace", skip(self, f))]
200200
fn with_let_source(&mut self, let_source: LetSource, f: impl FnOnce(&mut Self)) {
201201
let old_let_source = self.let_source;
@@ -224,7 +224,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
224224
/// subexpressions we are not handling ourselves.
225225
fn visit_land(
226226
&mut self,
227-
ex: &'thir Expr<'tcx>,
227+
ex: &'p Expr<'tcx>,
228228
accumulator: &mut Vec<Option<(Span, RefutableFlag)>>,
229229
) -> Result<(), ErrorGuaranteed> {
230230
match ex.kind {
@@ -251,7 +251,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
251251
/// expression. This must call `visit_expr` on the subexpressions we are not handling ourselves.
252252
fn visit_land_rhs(
253253
&mut self,
254-
ex: &'thir Expr<'tcx>,
254+
ex: &'p Expr<'tcx>,
255255
) -> Result<Option<(Span, RefutableFlag)>, ErrorGuaranteed> {
256256
match ex.kind {
257257
ExprKind::Scope { value, lint_level, .. } => {
@@ -276,7 +276,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
276276
fn lower_pattern(
277277
&mut self,
278278
cx: &MatchCheckCtxt<'p, 'tcx>,
279-
pat: &'thir Pat<'tcx>,
279+
pat: &'p Pat<'tcx>,
280280
) -> Result<&'p DeconstructedPat<'p, 'tcx>, ErrorGuaranteed> {
281281
if let Err(err) = pat.pat_error_reported() {
282282
self.error = Err(err);
@@ -395,7 +395,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
395395
}
396396

397397
#[instrument(level = "trace", skip(self))]
398-
fn check_let(&mut self, pat: &'thir Pat<'tcx>, scrutinee: Option<ExprId>, span: Span) {
398+
fn check_let(&mut self, pat: &'p Pat<'tcx>, scrutinee: Option<ExprId>, span: Span) {
399399
assert!(self.let_source != LetSource::None);
400400
let scrut = scrutinee.map(|id| &self.thir[id]);
401401
if let LetSource::PlainLet = self.let_source {
@@ -547,7 +547,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
547547

548548
fn analyze_binding(
549549
&mut self,
550-
pat: &'thir Pat<'tcx>,
550+
pat: &'p Pat<'tcx>,
551551
refutability: RefutableFlag,
552552
scrut: Option<&Expr<'tcx>>,
553553
) -> Result<(MatchCheckCtxt<'p, 'tcx>, UsefulnessReport<'p, 'tcx>), ErrorGuaranteed> {
@@ -560,7 +560,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
560560

561561
fn is_let_irrefutable(
562562
&mut self,
563-
pat: &'thir Pat<'tcx>,
563+
pat: &'p Pat<'tcx>,
564564
scrut: Option<&Expr<'tcx>>,
565565
) -> Result<RefutableFlag, ErrorGuaranteed> {
566566
let (cx, report) = self.analyze_binding(pat, Refutable, scrut)?;
@@ -575,7 +575,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
575575
#[instrument(level = "trace", skip(self))]
576576
fn check_binding_is_irrefutable(
577577
&mut self,
578-
pat: &'thir Pat<'tcx>,
578+
pat: &'p Pat<'tcx>,
579579
origin: &str,
580580
scrut: Option<&Expr<'tcx>>,
581581
sp: Option<Span>,
@@ -677,7 +677,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
677677
/// - `x @ Some(ref mut? y)`.
678678
///
679679
/// This analysis is *not* subsumed by NLL.
680-
fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, '_, 'tcx>, pat: &Pat<'tcx>) {
680+
fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, 'tcx>, pat: &Pat<'tcx>) {
681681
// Extract `sub` in `binding @ sub`.
682682
let PatKind::Binding { name, mode, ty, subpattern: Some(box ref sub), .. } = pat.kind else {
683683
return;
@@ -772,7 +772,7 @@ fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, '_, 'tcx>,
772772
}
773773

774774
fn check_for_bindings_named_same_as_variants(
775-
cx: &MatchVisitor<'_, '_, '_>,
775+
cx: &MatchVisitor<'_, '_>,
776776
pat: &Pat<'_>,
777777
rf: RefutableFlag,
778778
) {

compiler/rustc_pattern_analysis/src/rustc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ impl<'p, 'tcx> RustcMatchCheckCtxt<'p, 'tcx> {
399399

400400
/// Note: the input patterns must have been lowered through
401401
/// `rustc_mir_build::thir::pattern::check_match::MatchVisitor::lower_pattern`.
402-
pub fn lower_pat(&self, pat: &Pat<'tcx>) -> DeconstructedPat<'p, 'tcx> {
402+
pub fn lower_pat(&self, pat: &'p Pat<'tcx>) -> DeconstructedPat<'p, 'tcx> {
403403
let singleton = |pat| std::slice::from_ref(self.pattern_arena.alloc(pat));
404404
let cx = self;
405405
let ctor;

0 commit comments

Comments
 (0)