summaryrefslogtreecommitdiffstats
path: root/src/test/ui/error-codes/E0081.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/error-codes/E0081.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/error-codes/E0081.rs')
-rw-r--r--src/test/ui/error-codes/E0081.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/error-codes/E0081.rs b/src/test/ui/error-codes/E0081.rs
new file mode 100644
index 000000000..5aa6a7863
--- /dev/null
+++ b/src/test/ui/error-codes/E0081.rs
@@ -0,0 +1,31 @@
+enum Enum {
+ //~^ ERROR discriminant value `3` assigned more than once
+ P = 3,
+ //~^ NOTE first assignment of `3`
+ X = 3,
+ //~^ NOTE second assignment of `3`
+ Y = 5
+}
+
+#[repr(u8)]
+enum EnumOverflowRepr {
+ //~^ ERROR discriminant value `1` assigned more than once
+ P = 257,
+ //~^ NOTE first assignment of `1` (overflowed from `257`)
+ X = 513,
+ //~^ NOTE second assignment of `1` (overflowed from `513`)
+}
+
+#[repr(i8)]
+enum NegDisEnum {
+ //~^ ERROR discriminant value `-1` assigned more than once
+ First = -1,
+ //~^ NOTE first assignment of `-1`
+ Second = -2,
+ //~^ NOTE assigned discriminant for `Last` was incremented from this discriminant
+ Last,
+ //~^ NOTE second assignment of `-1`
+}
+
+fn main() {
+}