rust/src/test/ui/const-generics/argument_order.rs

25 lines
835 B
Rust
Raw Normal View History

// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct Bad<const N: usize, T> {
//[min]~^ ERROR type parameters must be declared prior to const parameters
arr: [u8; { N }],
another: T,
}
2020-07-23 13:19:35 +02:00
struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
//[full]~^ ERROR lifetime parameters must be declared prior
//[min]~^^ ERROR lifetime parameters must be declared prior to const parameters
//[min]~^^^ ERROR type parameters must be declared prior to const parameters
2020-07-23 13:19:35 +02:00
a: &'a T,
b: &'b U,
}
2020-07-23 14:30:01 +02:00
fn main() {
let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
//[full]~^ ERROR lifetime provided when a type was expected
//[min]~^^ ERROR lifetime provided when a type was expected
2020-07-23 14:30:01 +02:00
}