diff options
| author | varkor <github@varkor.com> | 2019-02-07 10:10:11 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-02-07 15:02:17 +0100 |
| commit | bbdcc4e7ce697bbd6ad398987c5e4ec4928f5da4 (patch) | |
| tree | 507022857394927fbb9adb152dcb55f70887ea72 /src/test | |
| parent | 899d013fefba27b66c655af4199ccecf8fb9fdae (diff) | |
| download | rust-bbdcc4e7ce697bbd6ad398987c5e4ec4928f5da4.tar.gz rust-bbdcc4e7ce697bbd6ad398987c5e4ec4928f5da4.zip | |
Adjust parser generic parameter errors
Diffstat (limited to 'src/test')
16 files changed, 67 insertions, 26 deletions
diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs index 2ef5f13f3d4..ca5fdd9da85 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs @@ -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() { diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr index 97c0a19a3da..55e7a987784 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr @@ -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> { diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs index f58ddd5fbda..c795612acf0 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs @@ -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() {} diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr index ff7ced77f25..acd0ae3678a 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr @@ -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> {} diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs index 44a7c9d7c8b..3cfc70b4185 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs @@ -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() {} diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr index b383e21e161..b9ca0097467 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr @@ -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 diff --git a/src/test/ui/const-generics/const-expression-parameter.rs b/src/test/ui/const-generics/const-expression-parameter.rs new file mode 100644 index 00000000000..c582c596bfc --- /dev/null +++ b/src/test/ui/const-generics/const-expression-parameter.rs @@ -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 +} diff --git a/src/test/ui/const-generics/const-expression-parameter.stderr b/src/test/ui/const-generics/const-expression-parameter.stderr new file mode 100644 index 00000000000..1dd3a960316 --- /dev/null +++ b/src/test/ui/const-generics/const-expression-parameter.stderr @@ -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 + diff --git a/src/test/ui/issues/issue-20616-3.rs b/src/test/ui/issues/issue-20616-3.rs index 9f983f74f5b..9bfd5bf2313 100644 --- a/src/test/ui/issues/issue-20616-3.rs +++ b/src/test/ui/issues/issue-20616-3.rs @@ -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 `,` diff --git a/src/test/ui/issues/issue-20616-3.stderr b/src/test/ui/issues/issue-20616-3.stderr index e8edb5ba70f..f51fb949c74 100644 --- a/src/test/ui/issues/issue-20616-3.stderr +++ b/src/test/ui/issues/issue-20616-3.stderr @@ -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 diff --git a/src/test/ui/issues/issue-20616-7.rs b/src/test/ui/issues/issue-20616-7.rs index 277b4524506..ffd1620c1d3 100644 --- a/src/test/ui/issues/issue-20616-7.rs +++ b/src/test/ui/issues/issue-20616-7.rs @@ -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 `,` diff --git a/src/test/ui/issues/issue-20616-7.stderr b/src/test/ui/issues/issue-20616-7.stderr index c1422d849fc..c0e108375be 100644 --- a/src/test/ui/issues/issue-20616-7.stderr +++ b/src/test/ui/issues/issue-20616-7.stderr @@ -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 diff --git a/src/test/ui/issues/issue-20616-8.rs b/src/test/ui/issues/issue-20616-8.rs index 756119e0127..c9e8b61e50b 100644 --- a/src/test/ui/issues/issue-20616-8.rs +++ b/src/test/ui/issues/issue-20616-8.rs @@ -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 `,` diff --git a/src/test/ui/issues/issue-20616-8.stderr b/src/test/ui/issues/issue-20616-8.stderr index cfe3ec57712..0ef9192f1e7 100644 --- a/src/test/ui/issues/issue-20616-8.stderr +++ b/src/test/ui/issues/issue-20616-8.stderr @@ -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 diff --git a/src/test/ui/issues/issue-20616-9.rs b/src/test/ui/issues/issue-20616-9.rs index 6074fbb2204..1c509f26fd6 100644 --- a/src/test/ui/issues/issue-20616-9.rs +++ b/src/test/ui/issues/issue-20616-9.rs @@ -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 `,` diff --git a/src/test/ui/issues/issue-20616-9.stderr b/src/test/ui/issues/issue-20616-9.stderr index 960e8c8c086..5fd1400a2e8 100644 --- a/src/test/ui/issues/issue-20616-9.stderr +++ b/src/test/ui/issues/issue-20616-9.stderr @@ -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 |
