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:
commit
e53a575ddb
@ -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()
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user