Skip to content

Commit ea93cb5

Browse files
committed
Do not specify type in generated let bindings.
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.
1 parent f8150f4 commit ea93cb5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/libsyntax/parse/parser.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -8691,15 +8691,16 @@ impl<'a> Parser<'a> {
86918691
}),
86928692
};
86938693

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

0 commit comments

Comments
 (0)