Check types live across yields in generators too
This commit is contained in:
parent
c21867f9f6
commit
79d685325c
13 changed files with 235 additions and 5 deletions
|
@ -3018,6 +3018,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
err.span_label(span, "this closure captures all values by move");
|
||||
}
|
||||
}
|
||||
ObligationCauseCode::SizedGeneratorInterior(generator_def_id) => {
|
||||
let what = match self.tcx.generator_kind(generator_def_id) {
|
||||
None | Some(hir::GeneratorKind::Gen) => "yield",
|
||||
Some(hir::GeneratorKind::Async(..)) => "await",
|
||||
};
|
||||
err.note(format!("all values live across `{what}` must have a statically known size"));
|
||||
}
|
||||
ObligationCauseCode::ConstPatternStructural => {
|
||||
err.note("constants used for pattern-matching must derive `PartialEq` and `Eq`");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue