]> git.lizzy.rs Git - rust.git/blob - tests/ui/const-generics/defaults/generic-expr-default.rs
Rollup merge of #105172 - alexs-sh:issue-98861-fix-next, r=scottmcm
[rust.git] / tests / ui / const-generics / defaults / generic-expr-default.rs
1 #![feature(generic_const_exprs)]
2 #![allow(incomplete_features)]
3
4 pub struct Foo<const N: usize, const M: usize = { N + 1 }>;
5 pub fn needs_evaluatable_bound<const N1: usize>() -> Foo<N1> {
6     //~^ error: unconstrained generic constant
7     loop {}
8 }
9 pub fn has_evaluatable_bound<const N1: usize>() -> Foo<N1> where [(); N1 + 1]: {
10     loop {}
11 }
12
13 type FooAlias<const N: usize, const NP: usize = { N + 1 }> = [(); NP];
14 fn needs_evaluatable_bound_alias<T, const N: usize>() -> FooAlias<N>
15 {
16     //~^^ error: unconstrained generic constant
17     todo!()
18 }
19 fn has_evaluatable_bound_alias<const N: usize>() -> FooAlias<N>
20 where [(); N + 1]: {
21     todo!()
22 }
23
24 fn main() {}