Auto merge of #116081 - compiler-errors:closure-captures-sized, r=cjgillot

Check that closure/generator's interior/capture types are sized

check that closure upvars and generator interiors are sized. this check is only necessary when `unsized_fn_params` or `unsized_locals` is enabled, so only check if those are active.

Fixes #93622
Fixes #61335
Fixes #68543
This commit is contained in:
bors
2023-09-23 10:01:49 +00:00
17 changed files with 296 additions and 4 deletions

View File

@@ -299,6 +299,10 @@ pub enum ObligationCauseCode<'tcx> {
SizedYieldType,
/// Inline asm operand type must be `Sized`.
InlineAsmSized,
/// Captured closure type must be `Sized`.
SizedClosureCapture(LocalDefId),
/// Types live across generator yields must be `Sized`.
SizedGeneratorInterior(LocalDefId),
/// `[expr; N]` requires `type_of(expr): Copy`.
RepeatElementCopy {
/// If element is a `const fn` we display a help message suggesting to move the