Remove incorrect assertion in type parsing code
This commit is contained in:
parent
c4c2ab57a4
commit
4e219e6335
5 changed files with 62 additions and 1 deletions
|
@ -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))?);
|
||||||
|
|
4
src/test/ui/parser/issue-84148-1.rs
Normal file
4
src/test/ui/parser/issue-84148-1.rs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
fn f(t:for<>t?)
|
||||||
|
//~^ ERROR: expected parameter name
|
||||||
|
//~| ERROR: expected one of
|
||||||
|
//~| ERROR: expected one of
|
23
src/test/ui/parser/issue-84148-1.stderr
Normal file
23
src/test/ui/parser/issue-84148-1.stderr
Normal 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
|
||||||
|
|
4
src/test/ui/parser/issue-84148-2.rs
Normal file
4
src/test/ui/parser/issue-84148-2.rs
Normal 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?
|
31
src/test/ui/parser/issue-84148-2.stderr
Normal file
31
src/test/ui/parser/issue-84148-2.stderr
Normal 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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue