]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/const-generic-function.rs
Auto merge of #95548 - rcvalle:rust-cfi-2, r=nagisa
[rust.git] / src / test / ui / const-generics / const-generic-function.rs
1 fn foo<const N: i32>() -> i32 {
2     N
3 }
4
5 const fn bar(n: i32, m: i32) -> i32 {
6     n
7 }
8
9 const fn baz() -> i32 {
10     1
11 }
12
13 const FOO: i32 = 3;
14
15 fn main() {
16     foo::<baz()>(); //~ ERROR expected type, found function `baz`
17     //~| ERROR unresolved item provided when a constant was expected
18     foo::<bar(bar(1, 1), bar(1, 1))>(); //~ ERROR expected type, found `1`
19     foo::<bar(1, 1)>(); //~ ERROR expected type, found `1`
20     foo::<bar(FOO, 2)>(); //~ ERROR expected type, found `2`
21 }