Rollup merge of #64830 - Centril:thou-shallt-not-abort, r=estebank

Thou shallt not `.abort_if_errors()`

r? @estebank
This commit is contained in:
Mazdak Farrokhzad 2019-09-28 05:37:52 +02:00 committed by GitHub
commit fc53088a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

View File

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

View File

@ -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;
};
}

View File

@ -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`.