rust/tests/ui/const-generics/defaults/generic-expr-default.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
662 B
Rust
Raw Normal View History

2021-10-23 15:57:49 +00:00
#![feature(generic_const_exprs)]
2021-07-10 16:38:39 +00: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() {}