1
Fork 0

Fix up some ui-fulldeps tests.

This commit is contained in:
Nicholas Nethercote 2023-12-18 14:13:53 +11:00
parent f6aa418c9f
commit 1e831e38ce
2 changed files with 22 additions and 22 deletions

View file

@ -13,7 +13,7 @@ extern crate rustc_session;
extern crate rustc_span; extern crate rustc_span;
use rustc_errors::{ use rustc_errors::{
AddToDiagnostic, Diagnostic, DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed, Handler, AddToDiagnostic, DiagCtxt, Diagnostic, DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed,
IntoDiagnostic, SubdiagnosticMessage, IntoDiagnostic, SubdiagnosticMessage,
}; };
use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_macros::{Diagnostic, Subdiagnostic};
@ -38,8 +38,8 @@ struct Note {
pub struct UntranslatableInIntoDiagnostic; pub struct UntranslatableInIntoDiagnostic;
impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for UntranslatableInIntoDiagnostic { impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for UntranslatableInIntoDiagnostic {
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> { fn into_diagnostic(self, dcx: &'a DiagCtxt) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
handler.struct_err("untranslatable diagnostic") dcx.struct_err("untranslatable diagnostic")
//~^ ERROR diagnostics should be created using translatable messages //~^ ERROR diagnostics should be created using translatable messages
} }
} }
@ -47,8 +47,8 @@ impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for UntranslatableInIntoDiagnostic
pub struct TranslatableInIntoDiagnostic; pub struct TranslatableInIntoDiagnostic;
impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for TranslatableInIntoDiagnostic { impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for TranslatableInIntoDiagnostic {
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> { fn into_diagnostic(self, dcx: &'a DiagCtxt) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
handler.struct_err(crate::fluent_generated::no_crate_example) dcx.struct_err(crate::fluent_generated::no_crate_example)
} }
} }
@ -75,11 +75,11 @@ impl AddToDiagnostic for TranslatableInAddToDiagnostic {
} }
} }
pub fn make_diagnostics<'a>(handler: &'a Handler) { pub fn make_diagnostics<'a>(dcx: &'a DiagCtxt) {
let _diag = handler.struct_err(crate::fluent_generated::no_crate_example); let _diag = dcx.struct_err(crate::fluent_generated::no_crate_example);
//~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
let _diag = handler.struct_err("untranslatable diagnostic"); let _diag = dcx.struct_err("untranslatable diagnostic");
//~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
//~^^ ERROR diagnostics should be created using translatable messages //~^^ ERROR diagnostics should be created using translatable messages
} }
@ -87,6 +87,6 @@ pub fn make_diagnostics<'a>(handler: &'a Handler) {
// Check that `rustc_lint_diagnostics`-annotated functions aren't themselves linted. // Check that `rustc_lint_diagnostics`-annotated functions aren't themselves linted.
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
pub fn skipped_because_of_annotation<'a>(handler: &'a Handler) { pub fn skipped_because_of_annotation<'a>(dcx: &'a DiagCtxt) {
let _diag = handler.struct_err("untranslatable diagnostic"); // okay! let _diag = dcx.struct_err("untranslatable diagnostic"); // okay!
} }

View file

@ -1,8 +1,8 @@
error: diagnostics should be created using translatable messages error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:42:17 --> $DIR/diagnostics.rs:42:13
| |
LL | handler.struct_err("untranslatable diagnostic") LL | dcx.struct_err("untranslatable diagnostic")
| ^^^^^^^^^^ | ^^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/diagnostics.rs:6:9 --> $DIR/diagnostics.rs:6:9
@ -17,10 +17,10 @@ LL | diag.note("untranslatable diagnostic");
| ^^^^ | ^^^^
error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
--> $DIR/diagnostics.rs:79:25 --> $DIR/diagnostics.rs:79:21
| |
LL | let _diag = handler.struct_err(crate::fluent_generated::no_crate_example); LL | let _diag = dcx.struct_err(crate::fluent_generated::no_crate_example);
| ^^^^^^^^^^ | ^^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/diagnostics.rs:7:9 --> $DIR/diagnostics.rs:7:9
@ -29,16 +29,16 @@ LL | #![deny(rustc::diagnostic_outside_of_impl)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
--> $DIR/diagnostics.rs:82:25 --> $DIR/diagnostics.rs:82:21
| |
LL | let _diag = handler.struct_err("untranslatable diagnostic"); LL | let _diag = dcx.struct_err("untranslatable diagnostic");
| ^^^^^^^^^^ | ^^^^^^^^^^
error: diagnostics should be created using translatable messages error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:82:25 --> $DIR/diagnostics.rs:82:21
| |
LL | let _diag = handler.struct_err("untranslatable diagnostic"); LL | let _diag = dcx.struct_err("untranslatable diagnostic");
| ^^^^^^^^^^ | ^^^^^^^^^^
error: aborting due to 5 previous errors error: aborting due to 5 previous errors