about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGurinder Singh <frederick.the.fool@gmail.com>2024-04-27 11:02:15 +0530
committerGurinder Singh <frederick.the.fool@gmail.com>2024-04-27 11:02:15 +0530
commitfc73b4c34488b92d6e6af32e063a39e000cd073b (patch)
treef59d2065ffc89a574f311aac2d364538a9dbd450
parent6acb9e75ebc936df737381a9d0b7a7bccd6f0b2f (diff)
downloadrust-fc73b4c34488b92d6e6af32e063a39e000cd073b.tar.gz
rust-fc73b4c34488b92d6e6af32e063a39e000cd073b.zip
Add missing tests for an ICE
-rw-r--r--tests/ui/consts/const-eval/ice-unhandled-type-122191.rs18
-rw-r--r--tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr58
2 files changed, 76 insertions, 0 deletions
diff --git a/tests/ui/consts/const-eval/ice-unhandled-type-122191.rs b/tests/ui/consts/const-eval/ice-unhandled-type-122191.rs
new file mode 100644
index 00000000000..a92b99976e2
--- /dev/null
+++ b/tests/ui/consts/const-eval/ice-unhandled-type-122191.rs
@@ -0,0 +1,18 @@
+type Foo = impl Send;
+//~^ ERROR `impl Trait` in type aliases is unstable
+
+struct A;
+
+const VALUE: Foo = value();
+//~^ ERROR cannot find function `value` in this scope
+
+fn test() {
+    match VALUE {
+        0 | 0 => {}
+//~^ ERROR mismatched types
+//~| ERROR mismatched types
+        _ => (),
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr b/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr
new file mode 100644
index 00000000000..daf0ccaa776
--- /dev/null
+++ b/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr
@@ -0,0 +1,58 @@
+error[E0658]: `impl Trait` in type aliases is unstable
+  --> $DIR/ice-unhandled-type-122191.rs:1:12
+   |
+LL | type Foo = impl Send;
+   |            ^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0425]: cannot find function `value` in this scope
+  --> $DIR/ice-unhandled-type-122191.rs:6:20
+   |
+LL | const VALUE: Foo = value();
+   |                    ^^^^^ not found in this scope
+
+error[E0308]: mismatched types
+  --> $DIR/ice-unhandled-type-122191.rs:11:9
+   |
+LL | type Foo = impl Send;
+   |            --------- the expected opaque type
+...
+LL |     match VALUE {
+   |           ----- this expression has type `Foo`
+LL |         0 | 0 => {}
+   |         ^ expected opaque type, found integer
+   |
+   = note: expected opaque type `Foo`
+                     found type `{integer}`
+note: this item must have the opaque type in its signature in order to be able to register hidden types
+  --> $DIR/ice-unhandled-type-122191.rs:9:4
+   |
+LL | fn test() {
+   |    ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/ice-unhandled-type-122191.rs:11:13
+   |
+LL | type Foo = impl Send;
+   |            --------- the expected opaque type
+...
+LL |     match VALUE {
+   |           ----- this expression has type `Foo`
+LL |         0 | 0 => {}
+   |             ^ expected opaque type, found integer
+   |
+   = note: expected opaque type `Foo`
+                     found type `{integer}`
+note: this item must have the opaque type in its signature in order to be able to register hidden types
+  --> $DIR/ice-unhandled-type-122191.rs:9:4
+   |
+LL | fn test() {
+   |    ^^^^
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0308, E0425, E0658.
+For more information about an error, try `rustc --explain E0308`.