Add test for const parameter before other generic parameters
This commit is contained in:
parent
ed51b6148f
commit
bf2f62cb98
@ -0,0 +1,13 @@
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
|
||||
fn foo<const X: (), T>(_: T) {
|
||||
//~^ ERROR type parameters must be declared prior to const parameters
|
||||
//~^^ ERROR const generics in any position are currently unsupported
|
||||
}
|
||||
|
||||
fn bar<const X: (), 'a>(_: &'a ()) {
|
||||
//~^ ERROR lifetime parameters must be declared prior to const parameters
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,26 @@
|
||||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
--> $DIR/const-param-before-other-params.rs:1:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: type parameters must be declared prior to const parameters
|
||||
--> $DIR/const-param-before-other-params.rs:4:21
|
||||
|
|
||||
LL | fn foo<const X: (), T>(_: T) {
|
||||
| --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, X>`
|
||||
|
||||
error: lifetime parameters must be declared prior to const parameters
|
||||
--> $DIR/const-param-before-other-params.rs:9:21
|
||||
|
|
||||
LL | fn bar<const X: (), 'a>(_: &'a ()) {
|
||||
| --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, X>`
|
||||
|
||||
error: const generics in any position are currently unsupported
|
||||
--> $DIR/const-param-before-other-params.rs:4:14
|
||||
|
|
||||
LL | fn foo<const X: (), T>(_: T) {
|
||||
| ^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user