Rollup merge of #53544 - estebank:issue-53534, r=varkor

Point at the trait argument when using unboxed closure

Fix #53534.

r? @varkor
This commit is contained in:
Guillaume Gomez 2018-08-22 17:45:37 +02:00 committed by GitHub
commit e53a575ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -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;
@ -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()
};

View File

@ -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