]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/const-expression-parameter.rs
Auto merge of #87150 - rusticstuff:simplify_wrapping_neg, r=m-ou-se
[rust.git] / src / test / ui / const-generics / const-expression-parameter.rs
1 // revisions: full min
2
3 #![cfg_attr(full, feature(const_generics))]
4 #![cfg_attr(full, allow(incomplete_features))]
5
6 fn i32_identity<const X: i32>() -> i32 {
7     5
8 }
9
10 fn foo_a() {
11     i32_identity::<-1>(); // ok
12 }
13
14 fn foo_b() {
15     i32_identity::<1 + 2>(); //~ ERROR expressions must be enclosed in braces
16 }
17
18 fn foo_c() {
19     i32_identity::< -1 >(); // ok
20 }
21
22 fn main() {
23     i32_identity::<5>(); // ok
24 }