2021-08-25 04:21:39 -05:00
|
|
|
#![feature(generic_const_exprs, const_generics, const_generics_defaults)]
|
2021-07-10 11:38:39 -05:00
|
|
|
#![allow(incomplete_features)]
|
|
|
|
|
|
|
|
pub struct Foo<const N: usize, const M: usize = { N + 1 }>;
|
|
|
|
pub fn needs_evaluatable_bound<const N1: usize>() -> Foo<N1> {
|
|
|
|
//~^ error: unconstrained generic constant
|
|
|
|
loop {}
|
|
|
|
}
|
|
|
|
pub fn has_evaluatable_bound<const N1: usize>() -> Foo<N1> where [(); N1 + 1]: {
|
|
|
|
loop {}
|
|
|
|
}
|
|
|
|
|
|
|
|
type FooAlias<const N: usize, const NP: usize = { N + 1 }> = [(); NP];
|
|
|
|
fn needs_evaluatable_bound_alias<T, const N: usize>() -> FooAlias<N>
|
|
|
|
{
|
|
|
|
//~^^ error: unconstrained generic constant
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
fn has_evaluatable_bound_alias<const N: usize>() -> FooAlias<N>
|
|
|
|
where [(); N + 1]: {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|