1
Fork 0

rustc_errors: let DiagnosticBuilder::emit return a "guarantee of emission".

This commit is contained in:
Eduard-Mihai Burtescu 2022-01-27 09:44:25 +00:00
parent 0b9d70cf6d
commit b7e95dee65
83 changed files with 842 additions and 471 deletions

View file

@ -1,5 +1,5 @@
use rustc_const_eval::util::CallDesugaringKind;
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder};
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorReported};
use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::mir::*;
use rustc_middle::ty;
@ -271,7 +271,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
&mut self,
place: Place<'tcx>,
span: Span,
) -> DiagnosticBuilder<'a> {
) -> DiagnosticBuilder<'a, ErrorReported> {
let description = if place.projection.len() == 1 {
format!("static item {}", self.describe_any_place(place.as_ref()))
} else {
@ -293,7 +293,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
deref_target_place: Place<'tcx>,
span: Span,
use_spans: Option<UseSpans<'tcx>>,
) -> DiagnosticBuilder<'a> {
) -> DiagnosticBuilder<'a, ErrorReported> {
// Inspect the type of the content behind the
// borrow to provide feedback about why this
// was a move rather than a copy.