Skip to content

Commit 7f5a19b

Browse files
DiagnosticBuilder -> Diagnostic
1 parent 24ac6a2 commit 7f5a19b

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use rustc_errors::{
2-
Applicability, Diagnostic, DiagnosticBuilder, EmissionGuarantee, ErrorGuaranteed,
3-
};
1+
use rustc_errors::{Applicability, Diagnostic};
42
use rustc_hir as hir;
53
use rustc_hir::intravisit::Visitor;
64
use rustc_hir::Node;
@@ -629,25 +627,20 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
629627
self.buffer_error(err);
630628
}
631629

632-
fn suggest_map_index_mut_alternatives(
633-
&self,
634-
ty: Ty<'_>,
635-
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
636-
span: Span,
637-
) {
630+
fn suggest_map_index_mut_alternatives(&self, ty: Ty<'tcx>, err: &mut Diagnostic, span: Span) {
638631
let Some(adt) = ty.ty_adt_def() else { return };
639632
let did = adt.did();
640633
if self.infcx.tcx.is_diagnostic_item(sym::HashMap, did)
641634
|| self.infcx.tcx.is_diagnostic_item(sym::BTreeMap, did)
642635
{
643-
struct V<'a, 'b, 'tcx, G: EmissionGuarantee> {
636+
struct V<'a, 'tcx> {
644637
assign_span: Span,
645-
err: &'a mut DiagnosticBuilder<'b, G>,
638+
err: &'a mut Diagnostic,
646639
ty: Ty<'tcx>,
647640
suggested: bool,
648641
}
649-
impl<'a, 'b: 'a, 'hir, 'tcx, G: EmissionGuarantee> Visitor<'hir> for V<'a, 'b, 'tcx, G> {
650-
fn visit_stmt(&mut self, stmt: &'hir hir::Stmt<'hir>) {
642+
impl<'a, 'tcx> Visitor<'tcx> for V<'a, 'tcx> {
643+
fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) {
651644
hir::intravisit::walk_stmt(self, stmt);
652645
let expr = match stmt.kind {
653646
hir::StmtKind::Semi(expr) | hir::StmtKind::Expr(expr) => expr,

compiler/rustc_passes/src/liveness.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ use self::VarKind::*;
8787
use rustc_ast::InlineAsmOptions;
8888
use rustc_data_structures::fx::FxIndexMap;
8989
use rustc_errors::Applicability;
90+
use rustc_errors::Diagnostic;
9091
use rustc_hir as hir;
9192
use rustc_hir::def::*;
9293
use rustc_hir::def_id::{DefId, LocalDefId};
@@ -1690,7 +1691,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
16901691
&self,
16911692
name: &str,
16921693
opt_body: Option<&hir::Body<'_>>,
1693-
err: &mut rustc_errors::DiagnosticBuilder<'_, ()>,
1694+
err: &mut Diagnostic,
16941695
) -> bool {
16951696
let mut has_litstring = false;
16961697
let Some(opt_body) = opt_body else {return false;};

compiler/rustc_resolve/src/late/diagnostics.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
405405

406406
fn try_lookup_name_relaxed(
407407
&mut self,
408-
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
408+
err: &mut Diagnostic,
409409
source: PathSource<'_>,
410410
path: &[Segment],
411411
span: Span,
@@ -465,7 +465,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
465465
.contains(span)
466466
{
467467
// Already reported this issue on the lhs of the type ascription.
468-
err.delay_as_bug();
468+
err.downgrade_to_delayed_bug();
469469
return (true, candidates);
470470
}
471471
}
@@ -576,7 +576,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
576576

577577
fn suggest_trait_and_bounds(
578578
&mut self,
579-
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
579+
err: &mut Diagnostic,
580580
source: PathSource<'_>,
581581
res: Option<Res>,
582582
span: Span,
@@ -651,7 +651,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
651651

652652
fn suggest_typo(
653653
&mut self,
654-
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
654+
err: &mut Diagnostic,
655655
source: PathSource<'_>,
656656
path: &[Segment],
657657
span: Span,
@@ -686,7 +686,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
686686

687687
fn err_code_special_cases(
688688
&mut self,
689-
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
689+
err: &mut Diagnostic,
690690
source: PathSource<'_>,
691691
path: &[Segment],
692692
span: Span,

0 commit comments

Comments
 (0)