about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2019-03-13 17:08:34 +0100
committerDavid Wood <david@davidtw.co>2019-04-21 16:46:32 +0100
commit92e72df2c1402d3d8fceac81e650b633c555a523 (patch)
tree5d6fe36f785f959875411412aba7717a887e3f77 /src/libsyntax/parse
parent61346557cef165e69beef7d4eb45583020ecf988 (diff)
downloadrust-92e72df2c1402d3d8fceac81e650b633c555a523.tar.gz
rust-92e72df2c1402d3d8fceac81e650b633c555a523.zip
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.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 26ede5a1057..172d5c38c77 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -8858,15 +8858,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 {