1
Fork 0

Fix one layer of closures not being able to constrain opaque types

This commit is contained in:
Oli Scherer 2023-06-29 07:52:45 +00:00
parent ef52dc7bb8
commit b549ba1bd4
3 changed files with 5 additions and 16 deletions

View file

@ -322,7 +322,10 @@ fn opaque_types_defined_by<'tcx>(tcx: TyCtxt<'tcx>, item: LocalDefId) -> &'tcx [
| DefKind::GlobalAsm
| DefKind::Impl { .. } => {}
DefKind::Closure | DefKind::Generator => {
return tcx.opaque_types_defined_by(tcx.local_parent(item));
// All items in the signature of the parent are ok
collector.opaques.extend(tcx.opaque_types_defined_by(tcx.local_parent(item)));
// And items in the body of the closure itself
collector.collect_taits_declared_in_body();
}
}
tcx.arena.alloc_from_iter(collector.opaques)