Restrict diagnostic context lifetime of mir borrowck to InferCtxt instead of TyCtxt
This commit is contained in:
parent
81695a147a
commit
ef559199ef
8 changed files with 75 additions and 75 deletions
|
@ -30,7 +30,7 @@ pub(crate) enum AccessKind {
|
|||
Mutate,
|
||||
}
|
||||
|
||||
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
|
||||
impl<'cx, 'tcx> MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
|
||||
pub(crate) fn report_mutability_error(
|
||||
&mut self,
|
||||
access_place: Place<'tcx>,
|
||||
|
@ -541,7 +541,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
|
|||
}
|
||||
|
||||
/// Suggest `map[k] = v` => `map.insert(k, v)` and the like.
|
||||
fn suggest_map_index_mut_alternatives(&self, ty: Ty<'tcx>, err: &mut Diag<'tcx>, span: Span) {
|
||||
fn suggest_map_index_mut_alternatives(&self, ty: Ty<'tcx>, err: &mut Diag<'cx>, span: Span) {
|
||||
let Some(adt) = ty.ty_adt_def() else { return };
|
||||
let did = adt.did();
|
||||
if self.infcx.tcx.is_diagnostic_item(sym::HashMap, did)
|
||||
|
@ -550,13 +550,13 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
|
|||
/// Walks through the HIR, looking for the corresponding span for this error.
|
||||
/// When it finds it, see if it corresponds to assignment operator whose LHS
|
||||
/// is an index expr.
|
||||
struct SuggestIndexOperatorAlternativeVisitor<'a, 'tcx> {
|
||||
struct SuggestIndexOperatorAlternativeVisitor<'a, 'cx, 'tcx> {
|
||||
assign_span: Span,
|
||||
err: &'a mut Diag<'tcx>,
|
||||
err: &'a mut Diag<'cx>,
|
||||
ty: Ty<'tcx>,
|
||||
suggested: bool,
|
||||
}
|
||||
impl<'a, 'tcx> Visitor<'tcx> for SuggestIndexOperatorAlternativeVisitor<'a, 'tcx> {
|
||||
impl<'a, 'cx, 'tcx> Visitor<'tcx> for SuggestIndexOperatorAlternativeVisitor<'a, 'cx, 'tcx> {
|
||||
fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) {
|
||||
hir::intravisit::walk_stmt(self, stmt);
|
||||
let expr = match stmt.kind {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue