summaryrefslogtreecommitdiffstats
path: root/tests/ui/enum
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/enum-discriminant/discriminant-ill-typed.rs (renamed from tests/ui/discrim/discrim-ill-typed.rs)0
-rw-r--r--tests/ui/enum-discriminant/discriminant-ill-typed.stderr91
-rw-r--r--tests/ui/enum-discriminant/discriminant-overflow-2.rs (renamed from tests/ui/discrim/discrim-overflow-2.rs)0
-rw-r--r--tests/ui/enum-discriminant/discriminant-overflow-2.stderr67
-rw-r--r--tests/ui/enum-discriminant/discriminant-overflow.rs (renamed from tests/ui/discrim/discrim-overflow.rs)0
-rw-r--r--tests/ui/enum-discriminant/discriminant-overflow.stderr67
-rw-r--r--tests/ui/enum-discriminant/issue-50689.rs (renamed from tests/ui/issues/issue-50689.rs)0
-rw-r--r--tests/ui/enum/suggest-default-attribute.stderr2
8 files changed, 226 insertions, 1 deletions
diff --git a/tests/ui/discrim/discrim-ill-typed.rs b/tests/ui/enum-discriminant/discriminant-ill-typed.rs
index 3cf0ea0e6..3cf0ea0e6 100644
--- a/tests/ui/discrim/discrim-ill-typed.rs
+++ b/tests/ui/enum-discriminant/discriminant-ill-typed.rs
diff --git a/tests/ui/enum-discriminant/discriminant-ill-typed.stderr b/tests/ui/enum-discriminant/discriminant-ill-typed.stderr
new file mode 100644
index 000000000..275714528
--- /dev/null
+++ b/tests/ui/enum-discriminant/discriminant-ill-typed.stderr
@@ -0,0 +1,91 @@
+error[E0308]: mismatched types
+ --> $DIR/discriminant-ill-typed.rs:15:16
+ |
+LL | OhNo = 0_u8,
+ | ^^^^ expected `i8`, found `u8`
+ |
+help: change the type of the numeric literal from `u8` to `i8`
+ |
+LL | OhNo = 0_i8,
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/discriminant-ill-typed.rs:28:16
+ |
+LL | OhNo = 0_i8,
+ | ^^^^ expected `u8`, found `i8`
+ |
+help: change the type of the numeric literal from `i8` to `u8`
+ |
+LL | OhNo = 0_u8,
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/discriminant-ill-typed.rs:41:16
+ |
+LL | OhNo = 0_u16,
+ | ^^^^^ expected `i16`, found `u16`
+ |
+help: change the type of the numeric literal from `u16` to `i16`
+ |
+LL | OhNo = 0_i16,
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/discriminant-ill-typed.rs:54:16
+ |
+LL | OhNo = 0_i16,
+ | ^^^^^ expected `u16`, found `i16`
+ |
+help: change the type of the numeric literal from `i16` to `u16`
+ |
+LL | OhNo = 0_u16,
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/discriminant-ill-typed.rs:67:16
+ |
+LL | OhNo = 0_u32,
+ | ^^^^^ expected `i32`, found `u32`
+ |
+help: change the type of the numeric literal from `u32` to `i32`
+ |
+LL | OhNo = 0_i32,
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/discriminant-ill-typed.rs:80:16
+ |
+LL | OhNo = 0_i32,
+ | ^^^^^ expected `u32`, found `i32`
+ |
+help: change the type of the numeric literal from `i32` to `u32`
+ |
+LL | OhNo = 0_u32,
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/discriminant-ill-typed.rs:93:16
+ |
+LL | OhNo = 0_u64,
+ | ^^^^^ expected `i64`, found `u64`
+ |
+help: change the type of the numeric literal from `u64` to `i64`
+ |
+LL | OhNo = 0_i64,
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/discriminant-ill-typed.rs:106:16
+ |
+LL | OhNo = 0_i64,
+ | ^^^^^ expected `u64`, found `i64`
+ |
+help: change the type of the numeric literal from `i64` to `u64`
+ |
+LL | OhNo = 0_u64,
+ | ~~~
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/discrim/discrim-overflow-2.rs b/tests/ui/enum-discriminant/discriminant-overflow-2.rs
index ca24317c5..ca24317c5 100644
--- a/tests/ui/discrim/discrim-overflow-2.rs
+++ b/tests/ui/enum-discriminant/discriminant-overflow-2.rs
diff --git a/tests/ui/enum-discriminant/discriminant-overflow-2.stderr b/tests/ui/enum-discriminant/discriminant-overflow-2.stderr
new file mode 100644
index 000000000..5f7387c59
--- /dev/null
+++ b/tests/ui/enum-discriminant/discriminant-overflow-2.stderr
@@ -0,0 +1,67 @@
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow-2.rs:13:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 127
+ |
+ = note: explicitly set `OhNo = -128` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow-2.rs:22:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 255
+ |
+ = note: explicitly set `OhNo = 0` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow-2.rs:31:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 32767
+ |
+ = note: explicitly set `OhNo = -32768` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow-2.rs:40:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 65535
+ |
+ = note: explicitly set `OhNo = 0` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow-2.rs:49:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 2147483647
+ |
+ = note: explicitly set `OhNo = -2147483648` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow-2.rs:58:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 4294967295
+ |
+ = note: explicitly set `OhNo = 0` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow-2.rs:67:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 9223372036854775807
+ |
+ = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow-2.rs:76:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 18446744073709551615
+ |
+ = note: explicitly set `OhNo = 0` if that is desired outcome
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0370`.
diff --git a/tests/ui/discrim/discrim-overflow.rs b/tests/ui/enum-discriminant/discriminant-overflow.rs
index 774ced93c..774ced93c 100644
--- a/tests/ui/discrim/discrim-overflow.rs
+++ b/tests/ui/enum-discriminant/discriminant-overflow.rs
diff --git a/tests/ui/enum-discriminant/discriminant-overflow.stderr b/tests/ui/enum-discriminant/discriminant-overflow.stderr
new file mode 100644
index 000000000..2ecc1839f
--- /dev/null
+++ b/tests/ui/enum-discriminant/discriminant-overflow.stderr
@@ -0,0 +1,67 @@
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow.rs:11:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 127
+ |
+ = note: explicitly set `OhNo = -128` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow.rs:22:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 255
+ |
+ = note: explicitly set `OhNo = 0` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow.rs:33:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 32767
+ |
+ = note: explicitly set `OhNo = -32768` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow.rs:44:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 65535
+ |
+ = note: explicitly set `OhNo = 0` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow.rs:56:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 2147483647
+ |
+ = note: explicitly set `OhNo = -2147483648` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow.rs:68:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 4294967295
+ |
+ = note: explicitly set `OhNo = 0` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow.rs:80:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 9223372036854775807
+ |
+ = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome
+
+error[E0370]: enum discriminant overflowed
+ --> $DIR/discriminant-overflow.rs:92:9
+ |
+LL | OhNo,
+ | ^^^^ overflowed on value after 18446744073709551615
+ |
+ = note: explicitly set `OhNo = 0` if that is desired outcome
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0370`.
diff --git a/tests/ui/issues/issue-50689.rs b/tests/ui/enum-discriminant/issue-50689.rs
index b49f29500..b49f29500 100644
--- a/tests/ui/issues/issue-50689.rs
+++ b/tests/ui/enum-discriminant/issue-50689.rs
diff --git a/tests/ui/enum/suggest-default-attribute.stderr b/tests/ui/enum/suggest-default-attribute.stderr
index fb830d3f7..b56d599a7 100644
--- a/tests/ui/enum/suggest-default-attribute.stderr
+++ b/tests/ui/enum/suggest-default-attribute.stderr
@@ -7,7 +7,7 @@ LL | #[default]
help: consider adding a derive
|
LL + #[derive(Default)]
-LL ~ pub enum Test {
+LL | pub enum Test {
|
error: aborting due to previous error