about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorjonboh <jon.bosque.hernando@gmail.com>2023-09-13 20:55:54 +0200
committerjonboh <jon.bosque.hernando@gmail.com>2023-10-29 17:34:11 +0100
commitc51e2a0f756f6de83800d4dfd68c455e4a089eb8 (patch)
tree900a5bd2da563a091890ba64c4cb6995ea614299 /tests
parentfa6fd8c346ed5b83d3411880ff5f473a27e689eb (diff)
downloadrust-c51e2a0f756f6de83800d4dfd68c455e4a089eb8.tar.gz
rust-c51e2a0f756f6de83800d4dfd68c455e4a089eb8.zip
fix enum_variant_names depending lint depending on order
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/enum_variants.rs17
-rw-r--r--tests/ui/enum_variants.stderr14
2 files changed, 30 insertions, 1 deletions
diff --git a/tests/ui/enum_variants.rs b/tests/ui/enum_variants.rs
index 85df852f729..ddf2dfdaea9 100644
--- a/tests/ui/enum_variants.rs
+++ b/tests/ui/enum_variants.rs
@@ -204,4 +204,21 @@ mod allow_attributes_on_variants {
     }
 }
 
+mod issue11494 {
+    // variant order should not affect lint
+    enum Data {
+        Valid,
+        Invalid,
+        DataDependent,
+        //~^ ERROR: variant name starts with the enum's name
+    }
+
+    enum Datas {
+        DatasDependent,
+        //~^ ERROR: variant name starts with the enum's name
+        Valid,
+        Invalid,
+    }
+}
+
 fn main() {}
diff --git a/tests/ui/enum_variants.stderr b/tests/ui/enum_variants.stderr
index 9ea80b635f4..b1e88de0fcf 100644
--- a/tests/ui/enum_variants.stderr
+++ b/tests/ui/enum_variants.stderr
@@ -158,5 +158,17 @@ LL | |     }
    |
    = help: remove the postfixes and use full paths to the variants instead of glob imports
 
-error: aborting due to 14 previous errors
+error: variant name starts with the enum's name
+  --> $DIR/enum_variants.rs:212:9
+   |
+LL |         DataDependent,
+   |         ^^^^^^^^^^^^^
+
+error: variant name starts with the enum's name
+  --> $DIR/enum_variants.rs:217:9
+   |
+LL |         DatasDependent,
+   |         ^^^^^^^^^^^^^^
+
+error: aborting due to 16 previous errors