Skip to content

Commit 1847a6c

Browse files
Extract deref coercion explanation into method
1 parent 99f4573 commit 1847a6c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,8 +1542,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15421542
None,
15431543
);
15441544

1545+
self.explain_deref_coercion(loan, &mut err);
1546+
1547+
err.buffer(&mut self.errors_buffer);
1548+
}
1549+
1550+
fn explain_deref_coercion(&mut self, loan: &BorrowData<'tcx>, err: &mut DiagnosticBuilder<'_>) {
15451551
let tcx = self.infcx.tcx;
1546-
// point out implicit deref coercion
15471552
if let (
15481553
Some(Terminator { kind: TerminatorKind::Call { from_hir_call: false, .. }, .. }),
15491554
Some((method_did, method_substs)),
@@ -1572,8 +1577,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15721577
}
15731578
}
15741579
}
1575-
1576-
err.buffer(&mut self.errors_buffer);
15771580
}
15781581

15791582
/// Reports an illegal reassignment; for example, an assignment to

0 commit comments

Comments
 (0)