Skip to content

Commit 8998e31

Browse files
authored
Rollup merge of #80513 - LeSeulArtichaut:80062-test, r=lcnr
Add regression test for #80062 Closes #80062. r? `@lcnr`
2 parents 9e8edc8 + 78498d0 commit 8998e31

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
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() {}
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)