Adjust parser generic parameter errors

This commit is contained in:
varkor 2019-02-07 10:10:11 +01:00
parent 899d013fef
commit bbdcc4e7ce
18 changed files with 93 additions and 54 deletions

View file

@ -7,7 +7,7 @@
struct RefIntPair<'a, 'b>(&'a u32, &'b u32);
impl<#[rustc_1] 'a, 'b, #[oops]> RefIntPair<'a, 'b> {
//~^ ERROR trailing attribute after lifetime parameter
//~^ ERROR trailing attribute after generic parameter
}
fn main() {

View file

@ -1,4 +1,4 @@
error: trailing attribute after lifetime parameter
error: trailing attribute after generic parameter
--> $DIR/attrs-with-no-formal-in-generics-1.rs:9:25
|
LL | impl<#[rustc_1] 'a, 'b, #[oops]> RefIntPair<'a, 'b> {

View file

@ -7,6 +7,6 @@
struct RefAny<'a, T>(&'a T);
impl<#[rustc_1] 'a, #[rustc_2] T, #[oops]> RefAny<'a, T> {}
//~^ ERROR trailing attribute after type parameter
//~^ ERROR trailing attribute after generic parameter
fn main() {}

View file

@ -1,4 +1,4 @@
error: trailing attribute after type parameter
error: trailing attribute after generic parameter
--> $DIR/attrs-with-no-formal-in-generics-2.rs:9:35
|
LL | impl<#[rustc_1] 'a, #[rustc_2] T, #[oops]> RefAny<'a, T> {}

View file

@ -6,7 +6,7 @@ struct RefIntPair<'a, 'b>(&'a u32, &'b u32);
fn hof_lt<Q>(_: Q)
where Q: for <#[allow(unused)] 'a, 'b, #[oops]> Fn(RefIntPair<'a,'b>) -> &'b u32
//~^ ERROR trailing attribute after lifetime parameter
//~^ ERROR trailing attribute after generic parameter
{}
fn main() {}

View file

@ -1,4 +1,4 @@
error: trailing attribute after lifetime parameter
error: trailing attribute after generic parameter
--> $DIR/attrs-with-no-formal-in-generics-3.rs:8:44
|
LL | where Q: for <#[allow(unused)] 'a, 'b, #[oops]> Fn(RefIntPair<'a,'b>) -> &'b u32

View file

@ -0,0 +1,19 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
fn u32_identity<const X: u32>() -> u32 {
//~^ ERROR const generics in any position are currently unsupported
5
}
fn foo_a() {
u32_identity::<-1>(); //~ ERROR expected identifier, found `<-`
}
fn foo_b() {
u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
}
fn main() {
u32_identity::<5>(); // ok
}

View file

@ -0,0 +1,26 @@
error: expected identifier, found `<-`
--> $DIR/const-expression-parameter.rs:10:19
|
LL | u32_identity::<-1>(); //~ ERROR expected identifier, found `<-`
| ^^ expected identifier
error: expected one of `,` or `>`, found `+`
--> $DIR/const-expression-parameter.rs:14:22
|
LL | u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
| ^ expected one of `,` or `>` here
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-expression-parameter.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
error: const generics in any position are currently unsupported
--> $DIR/const-expression-parameter.rs:4:23
|
LL | fn u32_identity<const X: u32>() -> u32 {
| ^
error: aborting due to 3 previous errors

View file

@ -1,5 +1,3 @@
// ignore-tidy-linelength
// We need all these 9 issue-20616-N.rs files
// because we can only catch one parsing error at a time
@ -12,7 +10,8 @@ type Type_1_<'a, T> = &'a T;
//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
type Type_3<T> = Box<T,,>; //~ error: expected one of `>`, const, identifier, lifetime, or type, found `,`
type Type_3<T> = Box<T,,>;
//~^ error: expected one of `>`, const, identifier, lifetime, or type, found `,`
//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`

View file

@ -1,7 +1,7 @@
error: expected one of `>`, const, identifier, lifetime, or type, found `,`
--> $DIR/issue-20616-3.rs:15:24
--> $DIR/issue-20616-3.rs:13:24
|
LL | type Type_3<T> = Box<T,,>; //~ error: expected one of `>`, const, identifier, lifetime, or type, found `,`
LL | type Type_3<T> = Box<T,,>;
| ^ expected one of `>`, const, identifier, lifetime, or type here
error: aborting due to previous error

View file

@ -1,5 +1,3 @@
// ignore-tidy-linelength
// We need all these 9 issue-20616-N.rs files
// because we can only catch one parsing error at a time
@ -27,7 +25,8 @@ type Type_5_<'a> = Type_1_<'a, ()>;
//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
type Type_7 = Box<(),,>; //~ error: expected one of `>`, const, identifier, lifetime, or type, found `,`
type Type_7 = Box<(),,>;
//~^ error: expected one of `>`, const, identifier, lifetime, or type, found `,`
//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`

View file

@ -1,7 +1,7 @@
error: expected one of `>`, const, identifier, lifetime, or type, found `,`
--> $DIR/issue-20616-7.rs:30:22
--> $DIR/issue-20616-7.rs:28:22
|
LL | type Type_7 = Box<(),,>; //~ error: expected one of `>`, const, identifier, lifetime, or type, found `,`
LL | type Type_7 = Box<(),,>;
| ^ expected one of `>`, const, identifier, lifetime, or type here
error: aborting due to previous error

View file

@ -1,5 +1,3 @@
// ignore-tidy-linelength
// We need all these 9 issue-20616-N.rs files
// because we can only catch one parsing error at a time
@ -30,7 +28,8 @@ type Type_5_<'a> = Type_1_<'a, ()>;
//type Type_7 = Box<(),,>; // error: expected type, found `,`
type Type_8<'a,,> = &'a (); //~ error: expected one of `>`, `const`, identifier, or lifetime, found `,`
type Type_8<'a,,> = &'a ();
//~^ error: expected one of `>`, `const`, identifier, or lifetime, found `,`
//type Type_9<T,,> = Box<T>; // error: expected identifier, found `,`

View file

@ -1,7 +1,7 @@
error: expected one of `>`, `const`, identifier, or lifetime, found `,`
--> $DIR/issue-20616-8.rs:33:16
--> $DIR/issue-20616-8.rs:31:16
|
LL | type Type_8<'a,,> = &'a (); //~ error: expected one of `>`, `const`, identifier, or lifetime, found `,`
LL | type Type_8<'a,,> = &'a ();
| ^ expected one of `>`, `const`, identifier, or lifetime here
error: aborting due to previous error

View file

@ -1,5 +1,3 @@
// ignore-tidy-linelength
// We need all these 9 issue-20616-N.rs files
// because we can only catch one parsing error at a time
@ -33,4 +31,5 @@ type Type_5_<'a> = Type_1_<'a, ()>;
//type Type_8<'a,,> = &'a (); // error: expected identifier, found `,`
type Type_9<T,,> = Box<T>; //~ error: expected one of `>`, `const`, identifier, or lifetime, found `,`
type Type_9<T,,> = Box<T>;
//~^ error: expected one of `>`, `const`, identifier, or lifetime, found `,`

View file

@ -1,7 +1,7 @@
error: expected one of `>`, `const`, identifier, or lifetime, found `,`
--> $DIR/issue-20616-9.rs:36:15
--> $DIR/issue-20616-9.rs:34:15
|
LL | type Type_9<T,,> = Box<T>; //~ error: expected one of `>`, `const`, identifier, or lifetime, found `,`
LL | type Type_9<T,,> = Box<T>;
| ^ expected one of `>`, `const`, identifier, or lifetime here
error: aborting due to previous error