Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression test for #74713 #99168

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/test/ui/const-generics/generic_const_exprs/issue-74713.rs
Original file line number Diff line number Diff line change
@@ -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() {}
22 changes: 22 additions & 0 deletions src/test/ui/const-generics/generic_const_exprs/issue-74713.stderr
Original file line number Diff line number Diff line change
@@ -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`.