Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 16bd6e2

Browse files
authoredJun 24, 2024··
Rollup merge of #126911 - oli-obk:do_not_count_errors, r=compiler-errors
Split the lifetimes of `MirBorrowckCtxt` These lifetimes are sometimes too general and will link things together that are independent. These are a blocker for actually finishing tracking more state (e.g. error tainting) in the diagnostic context handle, and I'd rather land it in its own PR instead of together with functional changes. Also changes a bunch of named lifetimes to `'_` where they were irrelevant follow-up to #126623
2 parents 59c258f + 8fc6b3d commit 16bd6e2

File tree

13 files changed

+73
-62
lines changed

13 files changed

+73
-62
lines changed
 

‎compiler/rustc_borrowck/src/borrowck_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_middle::span_bug;
66
use rustc_middle::ty::{self, Ty, TyCtxt};
77
use rustc_span::Span;
88

9-
impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
9+
impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
1010
pub fn dcx(&self) -> DiagCtxtHandle<'tcx> {
1111
self.infcx.dcx()
1212
}

‎compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<'tcx> UniverseInfo<'tcx> {
5252

5353
pub(crate) fn report_error(
5454
&self,
55-
mbcx: &mut MirBorrowckCtxt<'_, 'tcx>,
55+
mbcx: &mut MirBorrowckCtxt<'_, '_, '_, 'tcx>,
5656
placeholder: ty::PlaceholderRegion,
5757
error_element: RegionElement,
5858
cause: ObligationCause<'tcx>,
@@ -151,7 +151,7 @@ trait TypeOpInfo<'tcx> {
151151

152152
fn nice_error(
153153
&self,
154-
mbcx: &mut MirBorrowckCtxt<'_, 'tcx>,
154+
mbcx: &mut MirBorrowckCtxt<'_, '_, '_, 'tcx>,
155155
cause: ObligationCause<'tcx>,
156156
placeholder_region: ty::Region<'tcx>,
157157
error_region: Option<ty::Region<'tcx>>,
@@ -160,7 +160,7 @@ trait TypeOpInfo<'tcx> {
160160
#[instrument(level = "debug", skip(self, mbcx))]
161161
fn report_error(
162162
&self,
163-
mbcx: &mut MirBorrowckCtxt<'_, 'tcx>,
163+
mbcx: &mut MirBorrowckCtxt<'_, '_, '_, 'tcx>,
164164
placeholder: ty::PlaceholderRegion,
165165
error_element: RegionElement,
166166
cause: ObligationCause<'tcx>,
@@ -233,7 +233,7 @@ impl<'tcx> TypeOpInfo<'tcx> for PredicateQuery<'tcx> {
233233

234234
fn nice_error(
235235
&self,
236-
mbcx: &mut MirBorrowckCtxt<'_, 'tcx>,
236+
mbcx: &mut MirBorrowckCtxt<'_, '_, '_, 'tcx>,
237237
cause: ObligationCause<'tcx>,
238238
placeholder_region: ty::Region<'tcx>,
239239
error_region: Option<ty::Region<'tcx>>,
@@ -270,7 +270,7 @@ where
270270

271271
fn nice_error(
272272
&self,
273-
mbcx: &mut MirBorrowckCtxt<'_, 'tcx>,
273+
mbcx: &mut MirBorrowckCtxt<'_, '_, '_, 'tcx>,
274274
cause: ObligationCause<'tcx>,
275275
placeholder_region: ty::Region<'tcx>,
276276
error_region: Option<ty::Region<'tcx>>,
@@ -310,7 +310,7 @@ impl<'tcx> TypeOpInfo<'tcx> for AscribeUserTypeQuery<'tcx> {
310310

311311
fn nice_error(
312312
&self,
313-
mbcx: &mut MirBorrowckCtxt<'_, 'tcx>,
313+
mbcx: &mut MirBorrowckCtxt<'_, '_, '_, 'tcx>,
314314
cause: ObligationCause<'tcx>,
315315
placeholder_region: ty::Region<'tcx>,
316316
error_region: Option<ty::Region<'tcx>>,
@@ -336,7 +336,7 @@ impl<'tcx> TypeOpInfo<'tcx> for crate::type_check::InstantiateOpaqueType<'tcx> {
336336

337337
fn nice_error(
338338
&self,
339-
mbcx: &mut MirBorrowckCtxt<'_, 'tcx>,
339+
mbcx: &mut MirBorrowckCtxt<'_, '_, '_, 'tcx>,
340340
_cause: ObligationCause<'tcx>,
341341
placeholder_region: ty::Region<'tcx>,
342342
error_region: Option<ty::Region<'tcx>>,

‎compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ enum StorageDeadOrDrop<'tcx> {
7373
Destructor(Ty<'tcx>),
7474
}
7575

76-
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
76+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
7777
pub(crate) fn report_use_of_moved_or_uninitialized(
7878
&mut self,
7979
location: Location,
@@ -4243,7 +4243,11 @@ enum AnnotatedBorrowFnSignature<'tcx> {
42434243
impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
42444244
/// Annotate the provided diagnostic with information about borrow from the fn signature that
42454245
/// helps explain.
4246-
pub(crate) fn emit(&self, cx: &MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diag<'_>) -> String {
4246+
pub(crate) fn emit(
4247+
&self,
4248+
cx: &MirBorrowckCtxt<'_, '_, '_, 'tcx>,
4249+
diag: &mut Diag<'_>,
4250+
) -> String {
42474251
match self {
42484252
&AnnotatedBorrowFnSignature::Closure { argument_ty, argument_span } => {
42494253
diag.span_label(

‎compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
389389
}
390390
}
391391

392-
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
392+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
393393
fn free_region_constraint_info(
394394
&self,
395395
borrow_region: RegionVid,

‎compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub(super) struct DescribePlaceOpt {
6969

7070
pub(super) struct IncludingTupleField(pub(super) bool);
7171

72-
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
72+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
7373
/// Adds a suggestion when a closure is invoked twice with a moved variable or when a closure
7474
/// is moved after being invoked.
7575
///
@@ -771,7 +771,7 @@ struct CapturedMessageOpt {
771771
maybe_reinitialized_locations_is_empty: bool,
772772
}
773773

774-
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
774+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
775775
/// Finds the spans associated to a move or copy of move_place at location.
776776
pub(super) fn move_spans(
777777
&self,

‎compiler/rustc_borrowck/src/diagnostics/move_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ enum GroupedMoveError<'tcx> {
9393
},
9494
}
9595

96-
impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
96+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
9797
pub(crate) fn report_move_errors(&mut self) {
9898
let grouped_errors = self.group_move_errors();
9999
for error in grouped_errors {

‎compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub(crate) enum AccessKind {
3030
Mutate,
3131
}
3232

33-
impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
33+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
3434
pub(crate) fn report_mutability_error(
3535
&mut self,
3636
access_place: Place<'tcx>,

‎compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl OutlivesSuggestionBuilder {
7575
/// Returns a name for the region if it is suggestable. See `region_name_is_suggestable`.
7676
fn region_vid_to_name(
7777
&self,
78-
mbcx: &MirBorrowckCtxt<'_, '_>,
78+
mbcx: &MirBorrowckCtxt<'_, '_, '_, '_>,
7979
region: RegionVid,
8080
) -> Option<RegionName> {
8181
mbcx.give_region_a_name(region).filter(Self::region_name_is_suggestable)
@@ -84,7 +84,7 @@ impl OutlivesSuggestionBuilder {
8484
/// Compiles a list of all suggestions to be printed in the final big suggestion.
8585
fn compile_all_suggestions(
8686
&self,
87-
mbcx: &MirBorrowckCtxt<'_, '_>,
87+
mbcx: &MirBorrowckCtxt<'_, '_, '_, '_>,
8888
) -> SmallVec<[SuggestedConstraint; 2]> {
8989
let mut suggested = SmallVec::new();
9090

@@ -160,7 +160,7 @@ impl OutlivesSuggestionBuilder {
160160
/// Emit an intermediate note on the given `Diag` if the involved regions are suggestable.
161161
pub(crate) fn intermediate_suggestion(
162162
&mut self,
163-
mbcx: &MirBorrowckCtxt<'_, '_>,
163+
mbcx: &MirBorrowckCtxt<'_, '_, '_, '_>,
164164
errci: &ErrorConstraintInfo<'_>,
165165
diag: &mut Diag<'_>,
166166
) {
@@ -179,7 +179,7 @@ impl OutlivesSuggestionBuilder {
179179

180180
/// If there is a suggestion to emit, add a diagnostic to the buffer. This is the final
181181
/// suggestion including all collected constraints.
182-
pub(crate) fn add_suggestion(&self, mbcx: &mut MirBorrowckCtxt<'_, '_>) {
182+
pub(crate) fn add_suggestion(&self, mbcx: &mut MirBorrowckCtxt<'_, '_, '_, '_>) {
183183
// No constraints to add? Done.
184184
if self.constraints_to_add.is_empty() {
185185
debug!("No constraints to suggest.");

‎compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub struct ErrorConstraintInfo<'tcx> {
160160
pub(super) span: Span,
161161
}
162162

163-
impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
163+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
164164
/// Converts a region inference variable into a `ty::Region` that
165165
/// we can use for error reporting. If `r` is universally bound,
166166
/// then we use the name that we have on record for it. If `r` is

‎compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl rustc_errors::IntoDiagArg for RegionName {
198198
}
199199
}
200200

201-
impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
201+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
202202
pub(crate) fn mir_def_id(&self) -> hir::def_id::LocalDefId {
203203
self.body.source.def_id().expect_local()
204204
}

‎compiler/rustc_borrowck/src/lib.rs

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,11 @@ fn do_mir_borrowck<'tcx>(
310310
promoted_mbcx.report_move_errors();
311311
diags = promoted_mbcx.diags;
312312

313-
struct MoveVisitor<'a, 'cx, 'tcx> {
314-
ctxt: &'a mut MirBorrowckCtxt<'cx, 'tcx>,
313+
struct MoveVisitor<'a, 'b, 'mir, 'cx, 'tcx> {
314+
ctxt: &'a mut MirBorrowckCtxt<'b, 'mir, 'cx, 'tcx>,
315315
}
316316

317-
impl<'tcx> Visitor<'tcx> for MoveVisitor<'_, '_, 'tcx> {
317+
impl<'tcx> Visitor<'tcx> for MoveVisitor<'_, '_, '_, '_, 'tcx> {
318318
fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
319319
if let Operand::Move(place) = operand {
320320
self.ctxt.check_movable_place(location, *place);
@@ -528,15 +528,15 @@ impl<'tcx> Deref for BorrowckInferCtxt<'tcx> {
528528
}
529529
}
530530

531-
struct MirBorrowckCtxt<'cx, 'tcx> {
531+
struct MirBorrowckCtxt<'a, 'mir, 'cx, 'tcx> {
532532
infcx: &'cx BorrowckInferCtxt<'tcx>,
533533
param_env: ParamEnv<'tcx>,
534-
body: &'cx Body<'tcx>,
535-
move_data: &'cx MoveData<'tcx>,
534+
body: &'mir Body<'tcx>,
535+
move_data: &'a MoveData<'tcx>,
536536

537537
/// Map from MIR `Location` to `LocationIndex`; created
538538
/// when MIR borrowck begins.
539-
location_table: &'cx LocationTable,
539+
location_table: &'a LocationTable,
540540

541541
movable_coroutine: bool,
542542
/// This keeps track of whether local variables are free-ed when the function
@@ -605,14 +605,16 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
605605
// 2. loans made in overlapping scopes do not conflict
606606
// 3. assignments do not affect things loaned out as immutable
607607
// 4. moves do not affect things loaned out in any way
608-
impl<'cx, 'tcx, R> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx, R> for MirBorrowckCtxt<'cx, 'tcx> {
609-
type FlowState = Flows<'cx, 'tcx>;
608+
impl<'mir, 'tcx, R> rustc_mir_dataflow::ResultsVisitor<'mir, 'tcx, R>
609+
for MirBorrowckCtxt<'_, 'mir, '_, 'tcx>
610+
{
611+
type FlowState = Flows<'mir, 'tcx>;
610612

611613
fn visit_statement_before_primary_effect(
612614
&mut self,
613615
_results: &mut R,
614-
flow_state: &Flows<'cx, 'tcx>,
615-
stmt: &'cx Statement<'tcx>,
616+
flow_state: &Flows<'mir, 'tcx>,
617+
stmt: &'mir Statement<'tcx>,
616618
location: Location,
617619
) {
618620
debug!("MirBorrowckCtxt::process_statement({:?}, {:?}): {:?}", location, stmt, flow_state);
@@ -681,8 +683,8 @@ impl<'cx, 'tcx, R> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx, R> for MirBorro
681683
fn visit_terminator_before_primary_effect(
682684
&mut self,
683685
_results: &mut R,
684-
flow_state: &Flows<'cx, 'tcx>,
685-
term: &'cx Terminator<'tcx>,
686+
flow_state: &Flows<'mir, 'tcx>,
687+
term: &'mir Terminator<'tcx>,
686688
loc: Location,
687689
) {
688690
debug!("MirBorrowckCtxt::process_terminator({:?}, {:?}): {:?}", loc, term, flow_state);
@@ -792,8 +794,8 @@ impl<'cx, 'tcx, R> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx, R> for MirBorro
792794
fn visit_terminator_after_primary_effect(
793795
&mut self,
794796
_results: &mut R,
795-
flow_state: &Flows<'cx, 'tcx>,
796-
term: &'cx Terminator<'tcx>,
797+
flow_state: &Flows<'mir, 'tcx>,
798+
term: &'mir Terminator<'tcx>,
797799
loc: Location,
798800
) {
799801
let span = term.source_info.span;
@@ -969,8 +971,8 @@ impl InitializationRequiringAction {
969971
}
970972
}
971973

972-
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
973-
fn body(&self) -> &'cx Body<'tcx> {
974+
impl<'mir, 'tcx> MirBorrowckCtxt<'_, 'mir, '_, 'tcx> {
975+
fn body(&self) -> &'mir Body<'tcx> {
974976
self.body
975977
}
976978

@@ -986,7 +988,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
986988
place_span: (Place<'tcx>, Span),
987989
kind: (AccessDepth, ReadOrWrite),
988990
is_local_mutation_allowed: LocalMutationIsAllowed,
989-
flow_state: &Flows<'cx, 'tcx>,
991+
flow_state: &Flows<'mir, 'tcx>,
990992
) {
991993
let (sd, rw) = kind;
992994

@@ -1036,7 +1038,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10361038
place_span: (Place<'tcx>, Span),
10371039
sd: AccessDepth,
10381040
rw: ReadOrWrite,
1039-
flow_state: &Flows<'cx, 'tcx>,
1041+
flow_state: &Flows<'mir, 'tcx>,
10401042
) -> bool {
10411043
let mut error_reported = false;
10421044
let borrow_set = Rc::clone(&self.borrow_set);
@@ -1177,7 +1179,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11771179
location: Location,
11781180
place_span: (Place<'tcx>, Span),
11791181
kind: AccessDepth,
1180-
flow_state: &Flows<'cx, 'tcx>,
1182+
flow_state: &Flows<'mir, 'tcx>,
11811183
) {
11821184
// Write of P[i] or *P requires P init'd.
11831185
self.check_if_assigned_path_is_moved(location, place_span, flow_state);
@@ -1194,8 +1196,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11941196
fn consume_rvalue(
11951197
&mut self,
11961198
location: Location,
1197-
(rvalue, span): (&'cx Rvalue<'tcx>, Span),
1198-
flow_state: &Flows<'cx, 'tcx>,
1199+
(rvalue, span): (&'mir Rvalue<'tcx>, Span),
1200+
flow_state: &Flows<'mir, 'tcx>,
11991201
) {
12001202
match rvalue {
12011203
&Rvalue::Ref(_ /*rgn*/, bk, place) => {
@@ -1452,8 +1454,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14521454
fn consume_operand(
14531455
&mut self,
14541456
location: Location,
1455-
(operand, span): (&'cx Operand<'tcx>, Span),
1456-
flow_state: &Flows<'cx, 'tcx>,
1457+
(operand, span): (&'mir Operand<'tcx>, Span),
1458+
flow_state: &Flows<'mir, 'tcx>,
14571459
) {
14581460
match *operand {
14591461
Operand::Copy(place) => {
@@ -1573,7 +1575,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15731575
}
15741576
}
15751577

1576-
fn check_activations(&mut self, location: Location, span: Span, flow_state: &Flows<'cx, 'tcx>) {
1578+
fn check_activations(
1579+
&mut self,
1580+
location: Location,
1581+
span: Span,
1582+
flow_state: &Flows<'mir, 'tcx>,
1583+
) {
15771584
// Two-phase borrow support: For each activation that is newly
15781585
// generated at this statement, check if it interferes with
15791586
// another borrow.
@@ -1736,7 +1743,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
17361743
location: Location,
17371744
desired_action: InitializationRequiringAction,
17381745
place_span: (PlaceRef<'tcx>, Span),
1739-
flow_state: &Flows<'cx, 'tcx>,
1746+
flow_state: &Flows<'mir, 'tcx>,
17401747
) {
17411748
let maybe_uninits = &flow_state.uninits;
17421749

@@ -1841,7 +1848,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
18411848
location: Location,
18421849
desired_action: InitializationRequiringAction,
18431850
place_span: (PlaceRef<'tcx>, Span),
1844-
flow_state: &Flows<'cx, 'tcx>,
1851+
flow_state: &Flows<'mir, 'tcx>,
18451852
) {
18461853
let maybe_uninits = &flow_state.uninits;
18471854

@@ -1940,7 +1947,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
19401947
&mut self,
19411948
location: Location,
19421949
(place, span): (Place<'tcx>, Span),
1943-
flow_state: &Flows<'cx, 'tcx>,
1950+
flow_state: &Flows<'mir, 'tcx>,
19441951
) {
19451952
debug!("check_if_assigned_path_is_moved place: {:?}", place);
19461953

@@ -2001,12 +2008,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20012008
}
20022009
}
20032010

2004-
fn check_parent_of_field<'cx, 'tcx>(
2005-
this: &mut MirBorrowckCtxt<'cx, 'tcx>,
2011+
fn check_parent_of_field<'mir, 'tcx>(
2012+
this: &mut MirBorrowckCtxt<'_, 'mir, '_, 'tcx>,
20062013
location: Location,
20072014
base: PlaceRef<'tcx>,
20082015
span: Span,
2009-
flow_state: &Flows<'cx, 'tcx>,
2016+
flow_state: &Flows<'mir, 'tcx>,
20102017
) {
20112018
// rust-lang/rust#21232: Until Rust allows reads from the
20122019
// initialized parts of partially initialized structs, we
@@ -2097,7 +2104,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20972104
(place, span): (Place<'tcx>, Span),
20982105
kind: ReadOrWrite,
20992106
is_local_mutation_allowed: LocalMutationIsAllowed,
2100-
flow_state: &Flows<'cx, 'tcx>,
2107+
flow_state: &Flows<'mir, 'tcx>,
21012108
location: Location,
21022109
) -> bool {
21032110
debug!(
@@ -2213,15 +2220,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
22132220
fn is_local_ever_initialized(
22142221
&self,
22152222
local: Local,
2216-
flow_state: &Flows<'cx, 'tcx>,
2223+
flow_state: &Flows<'mir, 'tcx>,
22172224
) -> Option<InitIndex> {
22182225
let mpi = self.move_data.rev_lookup.find_local(local)?;
22192226
let ii = &self.move_data.init_path_map[mpi];
22202227
ii.into_iter().find(|&&index| flow_state.ever_inits.contains(index)).copied()
22212228
}
22222229

22232230
/// Adds the place into the used mutable variables set
2224-
fn add_used_mut(&mut self, root_place: RootPlace<'tcx>, flow_state: &Flows<'cx, 'tcx>) {
2231+
fn add_used_mut(&mut self, root_place: RootPlace<'tcx>, flow_state: &Flows<'mir, 'tcx>) {
22252232
match root_place {
22262233
RootPlace { place_local: local, place_projection: [], is_local_mutation_allowed } => {
22272234
// If the local may have been initialized, and it is now currently being
@@ -2476,7 +2483,7 @@ mod diags {
24762483
}
24772484
}
24782485

2479-
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
2486+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
24802487
pub fn buffer_error(&mut self, diag: Diag<'tcx>) {
24812488
self.diags.buffer_error(diag);
24822489
}

‎compiler/rustc_borrowck/src/prefixes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub(super) enum PrefixSet {
3434
Shallow,
3535
}
3636

37-
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
37+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
3838
/// Returns an iterator over the prefixes of `place`
3939
/// (inclusive) from longest to smallest, potentially
4040
/// terminating the iteration early based on `kind`.

‎compiler/rustc_borrowck/src/used_muts.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_middle::mir::{
66

77
use crate::MirBorrowckCtxt;
88

9-
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
9+
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
1010
/// Walks the MIR adding to the set of `used_mut` locals that will be ignored for the purposes
1111
/// of the `unused_mut` lint.
1212
///
@@ -45,13 +45,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
4545

4646
/// MIR visitor for collecting used mutable variables.
4747
/// The 'visit lifetime represents the duration of the MIR walk.
48-
struct GatherUsedMutsVisitor<'visit, 'cx, 'tcx> {
48+
struct GatherUsedMutsVisitor<'visit, 'a, 'mir, 'cx, 'tcx> {
4949
temporary_used_locals: FxIndexSet<Local>,
5050
never_initialized_mut_locals: &'visit mut FxIndexSet<Local>,
51-
mbcx: &'visit mut MirBorrowckCtxt<'cx, 'tcx>,
51+
mbcx: &'visit mut MirBorrowckCtxt<'a, 'mir, 'cx, 'tcx>,
5252
}
5353

54-
impl GatherUsedMutsVisitor<'_, '_, '_> {
54+
impl GatherUsedMutsVisitor<'_, '_, '_, '_, '_> {
5555
fn remove_never_initialized_mut_locals(&mut self, into: Place<'_>) {
5656
// Remove any locals that we found were initialized from the
5757
// `never_initialized_mut_locals` set. At the end, the only remaining locals will
@@ -63,7 +63,7 @@ impl GatherUsedMutsVisitor<'_, '_, '_> {
6363
}
6464
}
6565

66-
impl<'visit, 'cx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'cx, 'tcx> {
66+
impl<'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'_, '_, '_, '_, 'tcx> {
6767
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) {
6868
debug!("visit_terminator: terminator={:?}", terminator);
6969
match &terminator.kind {

0 commit comments

Comments
 (0)
Please sign in to comment.