Skip to content

Commit

Permalink
Do not specify type in generated let bindings.
Browse files Browse the repository at this point in the history
This avoids issues with `impl_trait_in_bindings` as the type from the
argument is normally used as the let binding, but `impl Trait` is
unstable in binding position.
  • Loading branch information
davidtwco committed Mar 24, 2019
1 parent f8150f4 commit ea93cb5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8691,15 +8691,16 @@ impl<'a> Parser<'a> {
}),
};

// Construct a `let <pat>: <ty> = __argN;` statement to insert at the top of the
// Construct a `let <pat> = __argN;` statement to insert at the top of the
// async closure.
let local = P(Local {
pat: input.pat.clone(),
ty: Some(P(Ty {
id,
node: input.ty.node.clone(),
span: input.ty.span,
})),
// We explicitly do not specify the type for this statement. When the user's
// argument type is `impl Trait` then this would require the
// `impl_trait_in_bindings` feature to also be present for that same type to
// be valid in this binding. At the time of writing (13 Mar 19),
// `impl_trait_in_bindings` is not stable.
ty: None,
init: Some(P(Expr {
id,
node: ExprKind::Path(None, ast::Path {
Expand Down

0 comments on commit ea93cb5

Please sign in to comment.