Skip to content

Commit

Permalink
lowering: don't .abort_if_errors()
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Sep 27, 2019
1 parent 0b1521f commit 9ef6edb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/librustc/hir/lowering/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,6 @@ impl LoweringContext<'_> {
E0628,
"generators cannot have explicit parameters"
);
self.sess.abort_if_errors();
}
Some(match movability {
Movability::Movable => hir::GeneratorMovability::Movable,
Expand Down Expand Up @@ -998,7 +997,7 @@ impl LoweringContext<'_> {
E0727,
"`async` generators are not yet supported",
);
self.sess.abort_if_errors();
return hir::ExprKind::Err;
},
None => self.generator_kind = Some(hir::GeneratorKind::Gen),
}
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/generator/no-parameters-on-generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

fn main() {
let gen = |start| { //~ ERROR generators cannot have explicit parameters
//~^ ERROR type inside generator must be known in this context
yield;
};
}
15 changes: 14 additions & 1 deletion src/test/ui/generator/no-parameters-on-generators.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,18 @@ error[E0628]: generators cannot have explicit parameters
LL | let gen = |start| {
| ^^^^^^^

error: aborting due to previous error
error[E0698]: type inside generator must be known in this context
--> $DIR/no-parameters-on-generators.rs:4:16
|
LL | let gen = |start| {
| ^^^^^ cannot infer type
|
note: the type is part of the generator because of this `yield`
--> $DIR/no-parameters-on-generators.rs:6:9
|
LL | yield;
| ^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0698`.

0 comments on commit 9ef6edb

Please sign in to comment.