From b5449b73e65e4e9622a4558e84774cc22755a17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Thu, 6 Jul 2017 22:08:45 +0200 Subject: [PATCH] Ban explicit arguments on generators --- src/librustc/hir/lowering.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 8b092ff727eb..50c8763600fa 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1958,6 +1958,11 @@ impl<'a> LoweringContext<'a> { 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,