Ban explicit arguments on generators

This commit is contained in:
John Kåre Alsaker 2017-07-06 22:08:45 +02:00
parent 81030176dd
commit b5449b73e6

View file

@ -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,