diff options
Diffstat (limited to 'tests/ui-fulldeps/internal-lints/diagnostics.rs')
-rw-r--r-- | tests/ui-fulldeps/internal-lints/diagnostics.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.rs b/tests/ui-fulldeps/internal-lints/diagnostics.rs index 643e81d99..3aa65d53d 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.rs +++ b/tests/ui-fulldeps/internal-lints/diagnostics.rs @@ -13,20 +13,22 @@ extern crate rustc_span; use rustc_errors::{ AddToDiagnostic, IntoDiagnostic, Diagnostic, DiagnosticBuilder, - ErrorGuaranteed, Handler, fluent, SubdiagnosticMessage, + ErrorGuaranteed, Handler, DiagnosticMessage, SubdiagnosticMessage, }; -use rustc_macros::{Diagnostic, Subdiagnostic}; +use rustc_macros::{fluent_messages, Diagnostic, Subdiagnostic}; use rustc_span::Span; +fluent_messages! { "./diagnostics.ftl" } + #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct DeriveDiagnostic { #[primary_span] span: Span, } #[derive(Subdiagnostic)] -#[note(compiletest_example)] +#[note(no_crate_example)] struct Note { #[primary_span] span: Span, @@ -45,7 +47,7 @@ pub struct TranslatableInIntoDiagnostic; impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for TranslatableInIntoDiagnostic { fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> { - handler.struct_err(fluent::compiletest_example) + handler.struct_err(crate::fluent_generated::no_crate_example) } } @@ -68,12 +70,12 @@ impl AddToDiagnostic for TranslatableInAddToDiagnostic { where F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage, { - diag.note(fluent::note); + diag.note(crate::fluent_generated::no_crate_note); } } pub fn make_diagnostics<'a>(handler: &'a Handler) { - let _diag = handler.struct_err(fluent::compiletest_example); + let _diag = handler.struct_err(crate::fluent_generated::no_crate_example); //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls let _diag = handler.struct_err("untranslatable diagnostic"); |