1
Fork 0

Remove incorrect assertion in type parsing code

This commit is contained in:
Fabian Wolff 2021-06-04 19:48:24 +02:00
parent c4c2ab57a4
commit 4e219e6335
5 changed files with 62 additions and 1 deletions

View file

@ -334,7 +334,6 @@ impl<'a> Parser<'a> {
mut bounds: GenericBounds, mut bounds: GenericBounds,
plus: bool, plus: bool,
) -> PResult<'a, TyKind> { ) -> PResult<'a, TyKind> {
assert_ne!(self.token, token::Question);
if plus { if plus {
self.eat_plus(); // `+`, or `+=` gets split and `+` is discarded self.eat_plus(); // `+`, or `+=` gets split and `+` is discarded
bounds.append(&mut self.parse_generic_bounds(Some(self.prev_token.span))?); bounds.append(&mut self.parse_generic_bounds(Some(self.prev_token.span))?);

View file

@ -0,0 +1,4 @@
fn f(t:for<>t?)
//~^ ERROR: expected parameter name
//~| ERROR: expected one of
//~| ERROR: expected one of

View file

@ -0,0 +1,23 @@
error: expected parameter name, found `?`
--> $DIR/issue-84148-1.rs:1:14
|
LL | fn f(t:for<>t?)
| ^ expected parameter name
error: expected one of `(`, `)`, `+`, `,`, `::`, or `<`, found `?`
--> $DIR/issue-84148-1.rs:1:14
|
LL | fn f(t:for<>t?)
| ^
| |
| expected one of `(`, `)`, `+`, `,`, `::`, or `<`
| help: missing `,`
error: expected one of `->`, `;`, `where`, or `{`, found `<eof>`
--> $DIR/issue-84148-1.rs:1:15
|
LL | fn f(t:for<>t?)
| ^ expected one of `->`, `;`, `where`, or `{`
error: aborting due to 3 previous errors

View file

@ -0,0 +1,4 @@
// error-pattern: this file contains an unclosed delimiter
// error-pattern: expected parameter name
// error-pattern: expected one of
fn f(t:for<>t?

View file

@ -0,0 +1,31 @@
error: this file contains an unclosed delimiter
--> $DIR/issue-84148-2.rs:4:16
|
LL | fn f(t:for<>t?
| - ^
| |
| unclosed delimiter
error: expected parameter name, found `?`
--> $DIR/issue-84148-2.rs:4:14
|
LL | fn f(t:for<>t?
| ^ expected parameter name
error: expected one of `(`, `)`, `+`, `,`, `::`, or `<`, found `?`
--> $DIR/issue-84148-2.rs:4:14
|
LL | fn f(t:for<>t?
| ^
| |
| expected one of `(`, `)`, `+`, `,`, `::`, or `<`
| help: missing `,`
error: expected one of `->`, `;`, `where`, or `{`, found `<eof>`
--> $DIR/issue-84148-2.rs:4:16
|
LL | fn f(t:for<>t?
| ^ expected one of `->`, `;`, `where`, or `{`
error: aborting due to 4 previous errors