Add more test cases for untranslatable_diagnostic lint

This commit is contained in:
Pavel Grigorenko 2024-08-10 20:15:52 +03:00
parent 8291d68d92
commit 10ef6661bc
2 changed files with 34 additions and 1 deletions

View File

@ -117,4 +117,11 @@ pub fn skipped_because_of_annotation<'a>(dcx: DiagCtxtHandle<'a>) {
fn f(_x: impl Into<DiagMessage>, _y: impl Into<SubdiagMessage>) {}
fn g() {
f(crate::fluent_generated::no_crate_example, crate::fluent_generated::no_crate_example);
f("untranslatable diagnostic", crate::fluent_generated::no_crate_example);
//~^ ERROR diagnostics should be created using translatable messages
f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic");
//~^ ERROR diagnostics should be created using translatable messages
f("untranslatable diagnostic", "untranslatable diagnostic");
//~^ ERROR diagnostics should be created using translatable messages
//~^^ ERROR diagnostics should be created using translatable messages
}

View File

@ -46,5 +46,31 @@ error: diagnostics should be created using translatable messages
LL | let _diag = dcx.struct_err("untranslatable diagnostic");
| ^^^^^^^^^^
error: aborting due to 6 previous errors
error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:120:5
|
LL | f("untranslatable diagnostic", crate::fluent_generated::no_crate_example);
| ^
error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:122:5
|
LL | f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic");
| ^
error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:124:5
|
LL | f("untranslatable diagnostic", "untranslatable diagnostic");
| ^
error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:124:5
|
LL | f("untranslatable diagnostic", "untranslatable diagnostic");
| ^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 10 previous errors