From 899cb40809a85eb9d89f6da3268713b83175360a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 23 Feb 2024 10:20:45 +1100 Subject: Rename `DiagnosticBuilder` as `Diag`. Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy. --- compiler/rustc_errors/src/diagnostic_impls.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'compiler/rustc_errors/src/diagnostic_impls.rs') diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index bc1e81642ff..3db0abb48c2 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -1,7 +1,7 @@ use crate::diagnostic::DiagnosticLocation; use crate::{fluent_generated as fluent, AddToDiagnostic}; use crate::{ - DiagCtxt, DiagnosticArgValue, DiagnosticBuilder, EmissionGuarantee, ErrCode, IntoDiagnostic, + Diag, DiagCtxt, DiagnosticArgValue, EmissionGuarantee, ErrCode, IntoDiagnostic, IntoDiagnosticArg, Level, SubdiagnosticMessageOp, }; use rustc_ast as ast; @@ -250,44 +250,43 @@ impl IntoDiagnosticArg for hir::def::Res { } impl IntoDiagnostic<'_, G> for TargetDataLayoutErrors<'_> { - fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> DiagnosticBuilder<'_, G> { + fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> { match self { TargetDataLayoutErrors::InvalidAddressSpace { addr_space, err, cause } => { - DiagnosticBuilder::new(dcx, level, fluent::errors_target_invalid_address_space) + Diag::new(dcx, level, fluent::errors_target_invalid_address_space) .with_arg("addr_space", addr_space) .with_arg("cause", cause) .with_arg("err", err) } TargetDataLayoutErrors::InvalidBits { kind, bit, cause, err } => { - DiagnosticBuilder::new(dcx, level, fluent::errors_target_invalid_bits) + Diag::new(dcx, level, fluent::errors_target_invalid_bits) .with_arg("kind", kind) .with_arg("bit", bit) .with_arg("cause", cause) .with_arg("err", err) } TargetDataLayoutErrors::MissingAlignment { cause } => { - DiagnosticBuilder::new(dcx, level, fluent::errors_target_missing_alignment) + Diag::new(dcx, level, fluent::errors_target_missing_alignment) .with_arg("cause", cause) } TargetDataLayoutErrors::InvalidAlignment { cause, err } => { - DiagnosticBuilder::new(dcx, level, fluent::errors_target_invalid_alignment) + Diag::new(dcx, level, fluent::errors_target_invalid_alignment) .with_arg("cause", cause) .with_arg("err_kind", err.diag_ident()) .with_arg("align", err.align()) } TargetDataLayoutErrors::InconsistentTargetArchitecture { dl, target } => { - DiagnosticBuilder::new(dcx, level, fluent::errors_target_inconsistent_architecture) + Diag::new(dcx, level, fluent::errors_target_inconsistent_architecture) .with_arg("dl", dl) .with_arg("target", target) } TargetDataLayoutErrors::InconsistentTargetPointerWidth { pointer_size, target } => { - DiagnosticBuilder::new(dcx, level, fluent::errors_target_inconsistent_pointer_width) + Diag::new(dcx, level, fluent::errors_target_inconsistent_pointer_width) .with_arg("pointer_size", pointer_size) .with_arg("target", target) } TargetDataLayoutErrors::InvalidBitsSize { err } => { - DiagnosticBuilder::new(dcx, level, fluent::errors_target_invalid_bits_size) - .with_arg("err", err) + Diag::new(dcx, level, fluent::errors_target_invalid_bits_size).with_arg("err", err) } } } @@ -301,7 +300,7 @@ pub struct SingleLabelManySpans { impl AddToDiagnostic for SingleLabelManySpans { fn add_to_diagnostic_with>( self, - diag: &mut DiagnosticBuilder<'_, G>, + diag: &mut Diag<'_, G>, _: F, ) { diag.span_labels(self.spans, self.label); -- cgit 1.4.1-3-g733a5