]> git.lizzy.rs Git - rust.git/commitdiff
Ban explicit arguments on generators
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Thu, 6 Jul 2017 20:08:45 +0000 (22:08 +0200)
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Fri, 28 Jul 2017 13:46:23 +0000 (15:46 +0200)
src/librustc/hir/lowering.rs

index 8b092ff727ebf046c38085e7da3a9f1b22a73c8e..50c8763600fa5efd9f463ce031da2a637bcc4d52 100644 (file)
@@ -1958,6 +1958,11 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                             gen = this.impl_arg.map(|_| hir::GeneratorClause::Movable);
                             e
                         });
+                        if gen.is_some() && !decl.inputs.is_empty() {
+                            this.sess.span_fatal(
+                                    fn_decl_span,
+                                    &format!("generators cannot have explicit arguments"));
+                        }
                         hir::ExprClosure(this.lower_capture_clause(capture_clause),
                                          this.lower_fn_decl(decl),
                                          body_id,