Skip to content

Commit

Permalink
Point at the trait argument when using unboxed closure
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Aug 20, 2018
1 parent 1558ae7 commit 05d19fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1079,12 +1079,13 @@ impl<'a> Parser<'a> {
self.parse_seq_to_before_tokens(&[ket], sep, TokenExpectType::Expect, f)
}

fn parse_seq_to_before_tokens<T, F>(&mut self,
kets: &[&token::Token],
sep: SeqSep,
expect: TokenExpectType,
mut f: F)
-> PResult<'a, Vec<T>>
fn parse_seq_to_before_tokens<T, F>(
&mut self,
kets: &[&token::Token],
sep: SeqSep,
expect: TokenExpectType,
mut f: F,
) -> PResult<'a, Vec<T>>
where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
{
let mut first: bool = true;
Expand Down Expand Up @@ -2058,12 +2059,12 @@ impl<'a> Parser<'a> {
TokenExpectType::Expect,
|p| p.parse_ty())?;
self.bump(); // `)`
let span = lo.to(self.prev_span);
let output = if self.eat(&token::RArrow) {
Some(self.parse_ty_common(false, false)?)
} else {
None
};
let span = lo.to(self.prev_span);
ParenthesisedArgs { inputs, output, span }.into()
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:13
|
LL | fn f<F:Trait(isize) -> isize>(x: F) {}
| ^^^^^^^^^^^^^^^^ unexpected type argument
| ^^^^^^^ unexpected type argument

error[E0220]: associated type `Output` not found for `Trait`
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:24
Expand Down

0 comments on commit 05d19fb

Please sign in to comment.