Separate the lifetimes of the BorrowckInferCtxt
from the other borr… · rust-lang/rust@1c4d0ce (original) (raw)
`@@ -310,11 +310,11 @@ fn do_mir_borrowck<'tcx>(
`
310
310
` promoted_mbcx.report_move_errors();
`
311
311
` diags = promoted_mbcx.diags;
`
312
312
``
313
``
`-
struct MoveVisitor<'a, 'cx, 'tcx> {
`
314
``
`-
ctxt: &'a mut MirBorrowckCtxt<'cx, 'tcx>,
`
``
313
`+
struct MoveVisitor<'a, 'b, 'cx, 'tcx> {
`
``
314
`+
ctxt: &'a mut MirBorrowckCtxt<'b, 'cx, 'tcx>,
`
315
315
`}
`
316
316
``
317
``
`-
impl<'tcx> Visitor<'tcx> for MoveVisitor<'_, '_, 'tcx> {
`
``
317
`+
impl<'tcx> Visitor<'tcx> for MoveVisitor<'_, '_, '_, 'tcx> {
`
318
318
`fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
`
319
319
`if let Operand::Move(place) = operand {
`
320
320
`self.ctxt.check_movable_place(location, *place);
`
`@@ -528,15 +528,15 @@ impl<'tcx> Deref for BorrowckInferCtxt<'tcx> {
`
528
528
`}
`
529
529
`}
`
530
530
``
531
``
`-
struct MirBorrowckCtxt<'cx, 'tcx> {
`
``
531
`+
struct MirBorrowckCtxt<'a, 'cx, 'tcx> {
`
532
532
`infcx: &'cx BorrowckInferCtxt<'tcx>,
`
533
533
`param_env: ParamEnv<'tcx>,
`
534
``
`-
body: &'cx Body<'tcx>,
`
535
``
`-
move_data: &'cx MoveData<'tcx>,
`
``
534
`+
body: &'a Body<'tcx>,
`
``
535
`+
move_data: &'a MoveData<'tcx>,
`
536
536
``
537
537
`` /// Map from MIR Location
to LocationIndex
; created
``
538
538
`/// when MIR borrowck begins.
`
539
``
`-
location_table: &'cx LocationTable,
`
``
539
`+
location_table: &'a LocationTable,
`
540
540
``
541
541
`movable_coroutine: bool,
`
542
542
`/// This keeps track of whether local variables are free-ed when the function
`
`@@ -605,7 +605,9 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
`
605
605
`// 2. loans made in overlapping scopes do not conflict
`
606
606
`// 3. assignments do not affect things loaned out as immutable
`
607
607
`// 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> {
`
``
608
`+
impl<'cx, 'tcx, R> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx, R>
`
``
609
`+
for MirBorrowckCtxt<'_, 'cx, 'tcx>
`
``
610
`+
{
`
609
611
`type FlowState = Flows<'cx, 'tcx>;
`
610
612
``
611
613
`fn visit_statement_before_primary_effect(
`
`@@ -969,8 +971,8 @@ impl InitializationRequiringAction {
`
969
971
`}
`
970
972
`}
`
971
973
``
972
``
`-
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
`
973
``
`-
fn body(&self) -> &'cx Body<'tcx> {
`
``
974
`+
impl<'a, 'cx, 'tcx> MirBorrowckCtxt<'a, 'cx, 'tcx> {
`
``
975
`+
fn body(&self) -> &'a Body<'tcx> {
`
974
976
`self.body
`
975
977
`}
`
976
978
``
`@@ -2002,7 +2004,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
`
2002
2004
`}
`
2003
2005
``
2004
2006
`fn check_parent_of_field<'cx, 'tcx>(
`
2005
``
`-
this: &mut MirBorrowckCtxt<'cx, 'tcx>,
`
``
2007
`+
this: &mut MirBorrowckCtxt<'_, 'cx, 'tcx>,
`
2006
2008
`location: Location,
`
2007
2009
`base: PlaceRef<'tcx>,
`
2008
2010
`span: Span,
`
`@@ -2476,7 +2478,7 @@ mod diags {
`
2476
2478
`}
`
2477
2479
`}
`
2478
2480
``
2479
``
`-
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
`
``
2481
`+
impl<'cx, 'tcx> MirBorrowckCtxt<'_, 'cx, 'tcx> {
`
2480
2482
`pub fn buffer_error(&mut self, diag: Diag<'tcx>) {
`
2481
2483
`self.diags.buffer_error(diag);
`
2482
2484
`}
`