Closed
Description
Given the following code: playground
fn foo<const N: i32>() -> i32 {
N
}
const fn bar() -> i32 {
1
}
const fn baz(n: i32) -> i32 {
n
}
pub fn main() {
foo::<bar()>();
foo::<baz(1)>();
}
The current output is:
error: expected type, found `1`
--> src/main.rs:15:15
|
15 | foo::<baz(1)>();
| ^ expected type
error[E0573]: expected type, found function `bar`
--> src/main.rs:14:11
|
14 | foo::<bar()>();
| ^^^^^ not a type
error[E0747]: unresolved item provided when a constant was expected
--> src/main.rs:14:11
|
14 | foo::<bar()>();
| ^^^^^
|
help: if this generic argument was intended as a const parameter, surround it with braces
|
14 | foo::<{ bar() }>();
| + +
Some errors have detailed explanations: E0573, E0747.
For more information about an error, try `rustc --explain E0573`.
Ideally the output should also suggest adding braces to foo::<baz(1)>()