2019-02-07 09:10:11 +00:00
|
|
|
#![feature(const_generics)]
|
|
|
|
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
|
|
|
|
|
|
|
fn u32_identity<const X: u32>() -> u32 {
|
|
|
|
5
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo_a() {
|
|
|
|
u32_identity::<-1>(); //~ ERROR expected identifier, found `<-`
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo_b() {
|
|
|
|
u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
|
|
|
|
}
|
|
|
|
|
2019-02-07 13:58:47 +00:00
|
|
|
fn foo_c() {
|
|
|
|
u32_identity::< -1 >(); // ok
|
2019-02-20 01:20:22 +00:00
|
|
|
// FIXME(const_generics)
|
|
|
|
//~^^ ERROR cannot apply unary operator `-` to type `u32` [E0600]
|
2019-02-07 13:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-02-07 09:10:11 +00:00
|
|
|
fn main() {
|
|
|
|
u32_identity::<5>(); // ok
|
|
|
|
}
|