about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-12-23 20:02:29 +0100
committerGitHub <noreply@github.com>2023-12-23 20:02:29 +0100
commitaa2e5fadd8d924301e3ea1a8f55d222769f76fcb (patch)
tree99bb39ebe5b375263f6f4fa5deb2c90f7fa546c3 /tests
parent63290a90d36036a0f772f241d1f04969b89c2499 (diff)
parent3006814404c53a2a69d99c270b7239420fa2c8d0 (diff)
downloadrust-aa2e5fadd8d924301e3ea1a8f55d222769f76fcb.tar.gz
rust-aa2e5fadd8d924301e3ea1a8f55d222769f76fcb.zip
Rollup merge of #119255 - fee1-dead-contrib:fix-ice, r=compiler-errors
add a test for ICE #112822

closes #112822.
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.rs16
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.stderr18
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.rs
new file mode 100644
index 00000000000..61e31fc9786
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.rs
@@ -0,0 +1,16 @@
+#![feature(const_trait_impl, effects)]
+
+const fn test() -> impl ~const Fn() { //~ ERROR ~const can only be applied to `#[const_trait]` traits
+    const move || { //~ ERROR const closures are experimental
+        let sl: &[u8] = b"foo";
+
+        match sl {
+            [first, remainder @ ..] => {
+                assert_eq!(first, &b'f');
+            }
+            [] => panic!(),
+        }
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.stderr
new file mode 100644
index 00000000000..65808212314
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.stderr
@@ -0,0 +1,18 @@
+error[E0658]: const closures are experimental
+  --> $DIR/ice-112822-expected-type-for-param.rs:4:5
+   |
+LL |     const move || {
+   |     ^^^^^
+   |
+   = note: see issue #106003 <https://github.com/rust-lang/rust/issues/106003> for more information
+   = help: add `#![feature(const_closures)]` to the crate attributes to enable
+
+error: ~const can only be applied to `#[const_trait]` traits
+  --> $DIR/ice-112822-expected-type-for-param.rs:3:32
+   |
+LL | const fn test() -> impl ~const Fn() {
+   |                                ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.