Skip to content

Commit 10ef666

Browse files
committed
Add more test cases for untranslatable_diagnostic lint
1 parent 8291d68 commit 10ef666

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

tests/ui-fulldeps/internal-lints/diagnostics.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,11 @@ pub fn skipped_because_of_annotation<'a>(dcx: DiagCtxtHandle<'a>) {
117117
fn f(_x: impl Into<DiagMessage>, _y: impl Into<SubdiagMessage>) {}
118118
fn g() {
119119
f(crate::fluent_generated::no_crate_example, crate::fluent_generated::no_crate_example);
120+
f("untranslatable diagnostic", crate::fluent_generated::no_crate_example);
121+
//~^ ERROR diagnostics should be created using translatable messages
122+
f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic");
123+
//~^ ERROR diagnostics should be created using translatable messages
124+
f("untranslatable diagnostic", "untranslatable diagnostic");
125+
//~^ ERROR diagnostics should be created using translatable messages
126+
//~^^ ERROR diagnostics should be created using translatable messages
120127
}

tests/ui-fulldeps/internal-lints/diagnostics.stderr

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,31 @@ error: diagnostics should be created using translatable messages
4646
LL | let _diag = dcx.struct_err("untranslatable diagnostic");
4747
| ^^^^^^^^^^
4848

49-
error: aborting due to 6 previous errors
49+
error: diagnostics should be created using translatable messages
50+
--> $DIR/diagnostics.rs:120:5
51+
|
52+
LL | f("untranslatable diagnostic", crate::fluent_generated::no_crate_example);
53+
| ^
54+
55+
error: diagnostics should be created using translatable messages
56+
--> $DIR/diagnostics.rs:122:5
57+
|
58+
LL | f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic");
59+
| ^
60+
61+
error: diagnostics should be created using translatable messages
62+
--> $DIR/diagnostics.rs:124:5
63+
|
64+
LL | f("untranslatable diagnostic", "untranslatable diagnostic");
65+
| ^
66+
67+
error: diagnostics should be created using translatable messages
68+
--> $DIR/diagnostics.rs:124:5
69+
|
70+
LL | f("untranslatable diagnostic", "untranslatable diagnostic");
71+
| ^
72+
|
73+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
74+
75+
error: aborting due to 10 previous errors
5076

0 commit comments

Comments
 (0)