about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2022-07-13 10:38:47 +0200
committerGitHub <noreply@github.com>2022-07-13 10:38:47 +0200
commit75d03d6e9200e5ddfe0de55a45e4289d3081a437 (patch)
tree7b47e5bc838363bf3a677001eb0d978ae3894b4e
parent3b30cce56a92b227904ca5858131f6aff52cd952 (diff)
parent3de6d6bb13522198a0a177d290d081ccddb0f0f1 (diff)
downloadrust-75d03d6e9200e5ddfe0de55a45e4289d3081a437.tar.gz
rust-75d03d6e9200e5ddfe0de55a45e4289d3081a437.zip
Rollup merge of #99168 - TaKO8Ki:add-regression-test-for-74713, r=Dylan-DPC
Add regression test for #74713

closes #74713
-rw-r--r--src/test/ui/const-generics/generic_const_exprs/issue-74713.rs8
-rw-r--r--src/test/ui/const-generics/generic_const_exprs/issue-74713.stderr22
2 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-74713.rs b/src/test/ui/const-generics/generic_const_exprs/issue-74713.rs
new file mode 100644
index 00000000000..0bcb997d96c
--- /dev/null
+++ b/src/test/ui/const-generics/generic_const_exprs/issue-74713.rs
@@ -0,0 +1,8 @@
+fn bug<'a>()
+where
+    [(); { //~ ERROR mismatched types
+        let _: &'a (); //~ ERROR a non-static lifetime is not allowed in a `const`
+    }]:
+{}
+
+fn main() {}
diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-74713.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-74713.stderr
new file mode 100644
index 00000000000..e7673df0a02
--- /dev/null
+++ b/src/test/ui/const-generics/generic_const_exprs/issue-74713.stderr
@@ -0,0 +1,22 @@
+error[E0658]: a non-static lifetime is not allowed in a `const`
+  --> $DIR/issue-74713.rs:4:17
+   |
+LL |         let _: &'a ();
+   |                 ^^
+   |
+   = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
+   = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
+
+error[E0308]: mismatched types
+  --> $DIR/issue-74713.rs:3:10
+   |
+LL |       [(); {
+   |  __________^
+LL | |         let _: &'a ();
+LL | |     }]:
+   | |_____^ expected `usize`, found `()`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0308, E0658.
+For more information about an error, try `rustc --explain E0308`.