Rollup merge of #64830 - Centril:thou-shallt-not-abort, r=estebank
Thou shallt not `.abort_if_errors()` r? @estebank
This commit is contained in:
commit
fc53088a5c
@ -705,7 +705,6 @@ impl LoweringContext<'_> {
|
|||||||
E0628,
|
E0628,
|
||||||
"generators cannot have explicit parameters"
|
"generators cannot have explicit parameters"
|
||||||
);
|
);
|
||||||
self.sess.abort_if_errors();
|
|
||||||
}
|
}
|
||||||
Some(match movability {
|
Some(match movability {
|
||||||
Movability::Movable => hir::GeneratorMovability::Movable,
|
Movability::Movable => hir::GeneratorMovability::Movable,
|
||||||
@ -998,7 +997,7 @@ impl LoweringContext<'_> {
|
|||||||
E0727,
|
E0727,
|
||||||
"`async` generators are not yet supported",
|
"`async` generators are not yet supported",
|
||||||
);
|
);
|
||||||
self.sess.abort_if_errors();
|
return hir::ExprKind::Err;
|
||||||
},
|
},
|
||||||
None => self.generator_kind = Some(hir::GeneratorKind::Gen),
|
None => self.generator_kind = Some(hir::GeneratorKind::Gen),
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let gen = |start| { //~ ERROR generators cannot have explicit parameters
|
let gen = |start| { //~ ERROR generators cannot have explicit parameters
|
||||||
|
//~^ ERROR type inside generator must be known in this context
|
||||||
yield;
|
yield;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,18 @@ error[E0628]: generators cannot have explicit parameters
|
|||||||
LL | let gen = |start| {
|
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`.
|
||||||
|
Loading…
Reference in New Issue
Block a user