Skip to content

Commit

Permalink
Extract deref coercion explanation into method
Browse files Browse the repository at this point in the history
  • Loading branch information
sledgehammervampire committed Feb 22, 2021
1 parent 99f4573 commit 1847a6c
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -1542,8 +1542,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
None,
);

self.explain_deref_coercion(loan, &mut err);

err.buffer(&mut self.errors_buffer);
}

fn explain_deref_coercion(&mut self, loan: &BorrowData<'tcx>, err: &mut DiagnosticBuilder<'_>) {
let tcx = self.infcx.tcx;
// point out implicit deref coercion
if let (
Some(Terminator { kind: TerminatorKind::Call { from_hir_call: false, .. }, .. }),
Some((method_did, method_substs)),
Expand Down Expand Up @@ -1572,8 +1577,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
}
}

err.buffer(&mut self.errors_buffer);
}

/// Reports an illegal reassignment; for example, an assignment to
Expand Down

0 comments on commit 1847a6c

Please sign in to comment.