diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2017-07-06 22:08:45 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2017-07-28 15:46:23 +0200 |
| commit | b5449b73e65e4e9622a4558e84774cc22755a17d (patch) | |
| tree | 52efc588e76602ade813caf2027f52262618f1e4 | |
| parent | 81030176dd36ad1efc0149ff8d57626bf42006d1 (diff) | |
| download | rust-b5449b73e65e4e9622a4558e84774cc22755a17d.tar.gz rust-b5449b73e65e4e9622a4558e84774cc22755a17d.zip | |
Ban explicit arguments on generators
| -rw-r--r-- | src/librustc/hir/lowering.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 8b092ff727e..50c8763600f 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, |
