File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
src/test/ui/consts/const-eval Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ // https://github.com/rust-lang/rust/issues/69228
2+ // Used to give bogus suggestion about T not being Sized.
3+
4+ use std:: mem:: size_of;
5+
6+ fn foo < T > ( ) {
7+ let _arr: [ u8 ; size_of :: < T > ( ) ] ;
8+ //~^ ERROR generic parameters may not be used in const operations
9+ //~| NOTE cannot perform const operation
10+ //~| NOTE type parameters may not be used in const expressions
11+ }
12+
13+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: generic parameters may not be used in const operations
2+ --> $DIR/size-of-t.rs:7:30
3+ |
4+ LL | let _arr: [u8; size_of::<T>()];
5+ | ^ cannot perform const operation using `T`
6+ |
7+ = note: type parameters may not be used in const expressions
8+ = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
9+
10+ error: aborting due to previous error
11+
You can’t perform that action at this time.
0 commit comments