]> git.lizzy.rs Git - rust.git/blob - tests/ui/const-generics/generic_const_exprs/subexprs_are_const_evalutable.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / const-generics / generic_const_exprs / subexprs_are_const_evalutable.rs
1 // run-pass
2 #![feature(generic_const_exprs)]
3 #![allow(incomplete_features)]
4
5 fn make_array<const M: usize>() -> [(); M + 1] {
6     [(); M + 1]
7 }
8
9 fn foo<const N: usize>() -> [(); (N * 2) + 1] {
10     make_array::<{ N * 2 }>()
11 }
12
13 fn main() {
14     assert_eq!(foo::<10>(), [(); 10 * 2 + 1])
15 }
16
17 // Tests that N * 2 is considered const_evalutable by appearing as part of the (N * 2) + 1 const