about summary refs log tree commit diff
path: root/tests/ui/pattern
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2024-01-10 14:50:48 +0100
committerNadrieril <nadrieril+git@gmail.com>2024-01-10 14:50:48 +0100
commitdee657f9f908136daa268540debf2c025855bb83 (patch)
treeeaeaacd64a165cb158a54641995917524ff0a376 /tests/ui/pattern
parentf0511851bc4555346641efd2249328433b781355 (diff)
downloadrust-dee657f9f908136daa268540debf2c025855bb83.tar.gz
rust-dee657f9f908136daa268540debf2c025855bb83.zip
Add test case for #119778
Diffstat (limited to 'tests/ui/pattern')
-rw-r--r--tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs13
-rw-r--r--tests/ui/pattern/usefulness/issue-119778-type-error-ice.stderr35
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs b/tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs
new file mode 100644
index 00000000000..47333385bc1
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs
@@ -0,0 +1,13 @@
+fn main() {}
+
+fn foo() {
+    #[derive(Copy, Clone)]
+    struct Foo([u8; S]);
+    //~^ ERROR cannot find value `S`
+    //~| ERROR cannot find value `S`
+
+    type U = impl Copy;
+    //~^ ERROR `impl Trait` in type aliases is unstable
+    let foo: U = Foo(());
+    let Foo(()) = foo;
+}
diff --git a/tests/ui/pattern/usefulness/issue-119778-type-error-ice.stderr b/tests/ui/pattern/usefulness/issue-119778-type-error-ice.stderr
new file mode 100644
index 00000000000..93ef05decd2
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-119778-type-error-ice.stderr
@@ -0,0 +1,35 @@
+error[E0425]: cannot find value `S` in this scope
+  --> $DIR/issue-119778-type-error-ice.rs:5:21
+   |
+LL |     struct Foo([u8; S]);
+   |                     ^ not found in this scope
+   |
+help: you might be missing a const parameter
+   |
+LL |     struct Foo<const S: /* Type */>([u8; S]);
+   |               +++++++++++++++++++++
+
+error[E0425]: cannot find value `S` in this scope
+  --> $DIR/issue-119778-type-error-ice.rs:5:21
+   |
+LL |     struct Foo([u8; S]);
+   |                     ^ not found in this scope
+   |
+help: you might be missing a const parameter
+   |
+LL |     struct Foo<const S: /* Type */>([u8; S]);
+   |               +++++++++++++++++++++
+
+error[E0658]: `impl Trait` in type aliases is unstable
+  --> $DIR/issue-119778-type-error-ice.rs:9:14
+   |
+LL |     type U = impl Copy;
+   |              ^^^^^^^^^
+   |
+   = 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
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0425, E0658.
+For more information about an error, try `rustc --explain E0425`.