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
|
|
@ -13,7 +13,7 @@ extern crate rustc_session;
|
|||
extern crate rustc_span;
|
||||
|
||||
use rustc_errors::{
|
||||
AddToDiagnostic, DiagnosticBuilder, EmissionGuarantee, DiagCtxt, IntoDiagnostic, Level,
|
||||
AddToDiagnostic, Diag, EmissionGuarantee, DiagCtxt, IntoDiagnostic, Level,
|
||||
SubdiagnosticMessageOp,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
|
|
@ -38,8 +38,8 @@ struct Note {
|
|||
pub struct UntranslatableInIntoDiagnostic;
|
||||
|
||||
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UntranslatableInIntoDiagnostic {
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
|
||||
DiagnosticBuilder::new(dcx, level, "untranslatable diagnostic")
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
|
||||
Diag::new(dcx, level, "untranslatable diagnostic")
|
||||
//~^ ERROR diagnostics should be created using translatable messages
|
||||
}
|
||||
}
|
||||
|
|
@ -47,8 +47,8 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UntranslatableInIntoDia
|
|||
pub struct TranslatableInIntoDiagnostic;
|
||||
|
||||
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for TranslatableInIntoDiagnostic {
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
|
||||
DiagnosticBuilder::new(dcx, level, crate::fluent_generated::no_crate_example)
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
|
||||
Diag::new(dcx, level, crate::fluent_generated::no_crate_example)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ pub struct UntranslatableInAddToDiagnostic;
|
|||
impl AddToDiagnostic for UntranslatableInAddToDiagnostic {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut DiagnosticBuilder<'_, G>,
|
||||
diag: &mut Diag<'_, G>,
|
||||
f: F,
|
||||
) {
|
||||
diag.note("untranslatable diagnostic");
|
||||
|
|
@ -70,7 +70,7 @@ pub struct TranslatableInAddToDiagnostic;
|
|||
impl AddToDiagnostic for TranslatableInAddToDiagnostic {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut DiagnosticBuilder<'_, G>,
|
||||
diag: &mut Diag<'_, G>,
|
||||
f: F,
|
||||
) {
|
||||
diag.note(crate::fluent_generated::no_crate_note);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: diagnostics should be created using translatable messages
|
||||
--> $DIR/diagnostics.rs:42:9
|
||||
|
|
||||
LL | DiagnosticBuilder::new(dcx, level, "untranslatable diagnostic")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | Diag::new(dcx, level, "untranslatable diagnostic")
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/diagnostics.rs:6:9
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | arg: NotIntoDiagnosticArg,
|
|||
| ^^^^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg`
|
||||
|
|
||||
= help: normalized in stderr
|
||||
note: required by a bound in `DiagnosticBuilder::<'a, G>::arg`
|
||||
note: required by a bound in `Diag::<'a, G>::arg`
|
||||
--> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC
|
||||
= note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ LL | arg: NotIntoDiagnosticArg,
|
|||
| ^^^^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg`
|
||||
|
|
||||
= help: normalized in stderr
|
||||
note: required by a bound in `DiagnosticBuilder::<'a, G>::arg`
|
||||
note: required by a bound in `Diag::<'a, G>::arg`
|
||||
--> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC
|
||||
= note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -628,7 +628,7 @@ LL | other: Hello,
|
|||
| ^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
|
||||
|
|
||||
= help: normalized in stderr
|
||||
note: required by a bound in `DiagnosticBuilder::<'a, G>::arg`
|
||||
note: required by a bound in `Diag::<'a, G>::arg`
|
||||
--> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC
|
||||
= note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue