about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPavel Grigorenko <GrigorenkoPV@ya.ru>2024-08-10 20:15:52 +0300
committerPavel Grigorenko <GrigorenkoPV@ya.ru>2024-08-10 20:19:41 +0300
commit10ef6661bc6fe9430cc199a30d6c8a9c428c75f0 (patch)
tree4f90d2c814ba54303ed6310d4e97b0137a3418e2
parent8291d68d926cedcdc77973e4c68f0828156d5bd8 (diff)
downloadrust-10ef6661bc6fe9430cc199a30d6c8a9c428c75f0.tar.gz
rust-10ef6661bc6fe9430cc199a30d6c8a9c428c75f0.zip
Add more test cases for untranslatable_diagnostic lint
-rw-r--r--tests/ui-fulldeps/internal-lints/diagnostics.rs7
-rw-r--r--tests/ui-fulldeps/internal-lints/diagnostics.stderr28
2 files changed, 34 insertions, 1 deletions
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.rs b/tests/ui-fulldeps/internal-lints/diagnostics.rs
index 5fcff74064a..442f9d72c3f 100644
--- a/tests/ui-fulldeps/internal-lints/diagnostics.rs
+++ b/tests/ui-fulldeps/internal-lints/diagnostics.rs
@@ -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
 }
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.stderr b/tests/ui-fulldeps/internal-lints/diagnostics.stderr
index 669324ce5d4..c23da981ea2 100644
--- a/tests/ui-fulldeps/internal-lints/diagnostics.stderr
+++ b/tests/ui-fulldeps/internal-lints/diagnostics.stderr
@@ -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