Skip to content

Commit 78498d0

Browse files
Add regression test for #80062
1 parent d107a87 commit 78498d0

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Diff for: src/test/ui/const-generics/issues/issue-80062.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Regression test for issue #80062 (fixed by `min_const_generics`)
2+
3+
fn sof<T>() -> T { unimplemented!() }
4+
5+
fn test<T>() {
6+
let _: [u8; sof::<T>()];
7+
//~^ ERROR generic parameters may not be used in const operations
8+
}
9+
10+
fn main() {}

Diff for: src/test/ui/const-generics/issues/issue-80062.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: generic parameters may not be used in const operations
2+
--> $DIR/issue-80062.rs:6:23
3+
|
4+
LL | let _: [u8; sof::<T>()];
5+
| ^ cannot perform const operation using `T`
6+
|
7+
= note: type parameters may not be used in const expressions
8+
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)