Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tests/ui/const-generics/argument_order.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
struct Bad<const N: usize, T> {
//@ reference: items.generics.syntax.decl-order

struct Good<const N: usize, T> {
arr: [u8; { N }],
another: T,
}

struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
struct Bad<const N: usize, 'a, T, 'b, const M: usize, U> {
//~^ ERROR lifetime parameters must be declared prior
a: &'a T,
b: &'b U,
}

fn main() {
let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
let _: Bad<7, 'static, u32, 'static, 17, u16>;
//~^ ERROR lifetime provided when a type was expected
}
12 changes: 6 additions & 6 deletions tests/ui/const-generics/argument_order.stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
error: lifetime parameters must be declared prior to type and const parameters
--> $DIR/argument_order.rs:6:32
--> $DIR/argument_order.rs:8:28
|
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, const N: usize, T, const M: usize, U>`
LL | struct Bad<const N: usize, 'a, T, 'b, const M: usize, U> {
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, const N: usize, T, const M: usize, U>`

error[E0747]: lifetime provided when a type was expected
--> $DIR/argument_order.rs:13:23
--> $DIR/argument_order.rs:15:19
|
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
| ^^^^^^^
LL | let _: Bad<7, 'static, u32, 'static, 17, u16>;
| ^^^^^^^
|
= note: lifetime arguments must be provided before type arguments
= help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, N, T, M, U>`
Expand Down
Loading