Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 02ff9e0

Browse files
committedFeb 23, 2022
Replace &mut DiagnosticBuilder, in signatures, with &mut Diagnostic.
1 parent f24ff18 commit 02ff9e0

File tree

65 files changed

+369
-466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+369
-466
lines changed
 

‎compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use either::Either;
22
use rustc_const_eval::util::{CallDesugaringKind, CallKind};
33
use rustc_data_structures::fx::FxHashSet;
4-
use rustc_errors::{Applicability, DiagnosticBuilder};
4+
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder};
55
use rustc_hir as hir;
66
use rustc_hir::def_id::DefId;
77
use rustc_hir::{AsyncGeneratorKind, GeneratorKind};
@@ -782,7 +782,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
782782
#[instrument(level = "debug", skip(self, err))]
783783
fn suggest_using_local_if_applicable(
784784
&self,
785-
err: &mut DiagnosticBuilder<'_>,
785+
err: &mut Diagnostic,
786786
location: Location,
787787
(place, span): (Place<'tcx>, Span),
788788
gen_borrow_kind: BorrowKind,
@@ -855,7 +855,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
855855

856856
fn suggest_split_at_mut_if_applicable(
857857
&self,
858-
err: &mut DiagnosticBuilder<'_>,
858+
err: &mut Diagnostic,
859859
place: Place<'tcx>,
860860
borrowed_place: Place<'tcx>,
861861
) {
@@ -1835,7 +1835,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
18351835
self.buffer_error(err);
18361836
}
18371837

1838-
fn explain_deref_coercion(&mut self, loan: &BorrowData<'tcx>, err: &mut DiagnosticBuilder<'_>) {
1838+
fn explain_deref_coercion(&mut self, loan: &BorrowData<'tcx>, err: &mut Diagnostic) {
18391839
let tcx = self.infcx.tcx;
18401840
if let (
18411841
Some(Terminator { kind: TerminatorKind::Call { from_hir_call: false, .. }, .. }),
@@ -2362,11 +2362,7 @@ enum AnnotatedBorrowFnSignature<'tcx> {
23622362
impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
23632363
/// Annotate the provided diagnostic with information about borrow from the fn signature that
23642364
/// helps explain.
2365-
pub(crate) fn emit(
2366-
&self,
2367-
cx: &mut MirBorrowckCtxt<'_, 'tcx>,
2368-
diag: &mut DiagnosticBuilder<'_>,
2369-
) -> String {
2365+
pub(crate) fn emit(&self, cx: &mut MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diagnostic) -> String {
23702366
match self {
23712367
&AnnotatedBorrowFnSignature::Closure { argument_ty, argument_span } => {
23722368
diag.span_label(

‎compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::collections::VecDeque;
44

55
use rustc_data_structures::fx::FxHashSet;
6-
use rustc_errors::{Applicability, DiagnosticBuilder};
6+
use rustc_errors::{Applicability, Diagnostic};
77
use rustc_index::vec::IndexVec;
88
use rustc_infer::infer::NllRegionVariableOrigin;
99
use rustc_middle::mir::{
@@ -60,7 +60,7 @@ impl BorrowExplanation {
6060
tcx: TyCtxt<'tcx>,
6161
body: &Body<'tcx>,
6262
local_names: &IndexVec<Local, Option<Symbol>>,
63-
err: &mut DiagnosticBuilder<'_>,
63+
err: &mut Diagnostic,
6464
borrow_desc: &str,
6565
borrow_span: Option<Span>,
6666
multiple_borrow_span: Option<(Span, Span)>,
@@ -275,7 +275,7 @@ impl BorrowExplanation {
275275
}
276276
pub(crate) fn add_lifetime_bound_suggestion_to_diagnostic(
277277
&self,
278-
err: &mut DiagnosticBuilder<'_>,
278+
err: &mut Diagnostic,
279279
category: &ConstraintCategory,
280280
span: Span,
281281
region_name: &RegionName,

0 commit comments

Comments
 (0)