Skip to content

Commit 92e72df

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 6134655 commit 92e72df

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
@@ -8858,15 +8858,16 @@ impl<'a> Parser<'a> {
88588858
}),
88598859
};
88608860

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

0 commit comments

Comments
 (0)