Rename DiagnosticBuilder
as Diag
.
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
This commit is contained in:
parent
4e1f9bd528
commit
899cb40809
153 changed files with 1136 additions and 1367 deletions
|
@ -1,8 +1,8 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use rustc_errors::{
|
||||
codes::*, Applicability, DecorateLint, DiagCtxt, DiagnosticArgValue, DiagnosticBuilder,
|
||||
DiagnosticMessage, EmissionGuarantee, IntoDiagnostic, Level,
|
||||
codes::*, Applicability, DecorateLint, Diag, DiagCtxt, DiagnosticArgValue, DiagnosticMessage,
|
||||
EmissionGuarantee, IntoDiagnostic, Level,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::mir::{AssertKind, UnsafetyViolationDetails};
|
||||
|
@ -64,8 +64,8 @@ pub(crate) struct RequiresUnsafe {
|
|||
// but this would result in a lot of duplication.
|
||||
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for RequiresUnsafe {
|
||||
#[track_caller]
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
|
||||
let mut diag = DiagnosticBuilder::new(dcx, level, fluent::mir_transform_requires_unsafe);
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
|
||||
let mut diag = Diag::new(dcx, level, fluent::mir_transform_requires_unsafe);
|
||||
diag.code(E0133);
|
||||
diag.span(self.span);
|
||||
diag.span_label(self.span, self.details.label());
|
||||
|
@ -90,7 +90,7 @@ impl RequiresUnsafeDetail {
|
|||
// FIXME: make this translatable
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
fn add_subdiagnostics<G: EmissionGuarantee>(&self, diag: &mut DiagnosticBuilder<'_, G>) {
|
||||
fn add_subdiagnostics<G: EmissionGuarantee>(&self, diag: &mut Diag<'_, G>) {
|
||||
use UnsafetyViolationDetails::*;
|
||||
match self.violation {
|
||||
CallToUnsafeFunction => {
|
||||
|
@ -183,7 +183,7 @@ pub(crate) struct UnsafeOpInUnsafeFn {
|
|||
|
||||
impl<'a> DecorateLint<'a, ()> for UnsafeOpInUnsafeFn {
|
||||
#[track_caller]
|
||||
fn decorate_lint<'b>(self, diag: &'b mut DiagnosticBuilder<'a, ()>) {
|
||||
fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) {
|
||||
let desc = diag.dcx.eagerly_translate_to_string(self.details.label(), [].into_iter());
|
||||
diag.arg("details", desc);
|
||||
diag.span_label(self.details.span, self.details.label());
|
||||
|
@ -216,7 +216,7 @@ pub(crate) enum AssertLintKind {
|
|||
}
|
||||
|
||||
impl<'a, P: std::fmt::Debug> DecorateLint<'a, ()> for AssertLint<P> {
|
||||
fn decorate_lint<'b>(self, diag: &'b mut DiagnosticBuilder<'a, ()>) {
|
||||
fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) {
|
||||
let message = self.assert_kind.diagnostic_message();
|
||||
self.assert_kind.add_args(&mut |name, value| {
|
||||
diag.arg(name, value);
|
||||
|
@ -270,7 +270,7 @@ pub(crate) struct MustNotSupend<'tcx, 'a> {
|
|||
|
||||
// Needed for def_path_str
|
||||
impl<'a> DecorateLint<'a, ()> for MustNotSupend<'_, '_> {
|
||||
fn decorate_lint<'b>(self, diag: &'b mut rustc_errors::DiagnosticBuilder<'a, ()>) {
|
||||
fn decorate_lint<'b>(self, diag: &'b mut rustc_errors::Diag<'a, ()>) {
|
||||
diag.span_label(self.yield_sp, fluent::_subdiag::label);
|
||||
if let Some(reason) = self.reason {
|
||||
diag.subdiagnostic(diag.dcx, reason);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue