Skip to content
Permalink
Browse files

`token::LArrow` can begin arguments

`<-` may indicate the start of a negative const argument.
  • Loading branch information...
varkor committed May 6, 2019
1 parent 7ac0200 commit 594685b5a2f35e2ff4fc01aca2ae91de92ed0993
@@ -2319,7 +2319,8 @@ impl<'a> Parser<'a> {
let ident = self.parse_path_segment_ident()?;

let is_args_start = |token: &token::Token| match *token {
token::Lt | token::BinOp(token::Shl) | token::OpenDelim(token::Paren) => true,
token::Lt | token::BinOp(token::Shl) | token::OpenDelim(token::Paren)
| token::LArrow => true,
_ => false,
};
let check_args_start = |this: &mut Self| {
@@ -6,7 +6,7 @@ fn i32_identity<const X: i32>() -> i32 {
}

fn foo_a() {
i32_identity::<-1>(); //~ ERROR expected identifier, found `<-`
i32_identity::<-1>(); // ok
}

fn foo_b() {
@@ -1,9 +1,3 @@
error: expected identifier, found `<-`
--> $DIR/const-expression-parameter.rs:9:19
|
LL | i32_identity::<-1>();
| ^^ expected identifier

error: expected one of `,` or `>`, found `+`
--> $DIR/const-expression-parameter.rs:13:22
|
@@ -16,5 +10,5 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^

error: aborting due to 2 previous errors
error: aborting due to previous error

0 comments on commit 594685b

Please sign in to comment.
You can’t perform that action at this time.