Do not ICE when evaluating locals' types of invalid yield
When a `yield` is outside of a generator, check its value regardless to avoid an ICE while trying to get all locals' types in writeback. Fix #78653.
This commit is contained in:
parent
8fe989dd76
commit
3eb454aabe
3 changed files with 30 additions and 0 deletions
|
@ -2081,6 +2081,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
_ => {
|
||||
self.tcx.sess.emit_err(YieldExprOutsideOfGenerator { span: expr.span });
|
||||
// Avoid expressions without types during writeback (#78653).
|
||||
self.check_expr(value);
|
||||
self.tcx.mk_unit()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue