Rollup merge of #130199 - compiler-errors:by-move, r=cjgillot
Don't call closure_by_move_body_def_id on FnOnce async closures in MIR validation Refactors the check in #129847 to not unncessarily call the `closure_by_move_body_def_id` query for async closures that don't *need* a by-move body. Fixes #130167
This commit is contained in:
commit
04e744e77d
5 changed files with 24 additions and 8 deletions
|
@ -3171,7 +3171,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
self.impl_trait_header(def_id).map_or(ty::ImplPolarity::Positive, |h| h.polarity)
|
||||
}
|
||||
|
||||
pub fn needs_coroutine_by_move_body_def_id(self, def_id: LocalDefId) -> bool {
|
||||
pub fn needs_coroutine_by_move_body_def_id(self, def_id: DefId) -> bool {
|
||||
if let Some(hir::CoroutineKind::Desugared(_, hir::CoroutineSource::Closure)) =
|
||||
self.coroutine_kind(def_id)
|
||||
&& let ty::Coroutine(_, args) = self.type_of(def_id).instantiate_identity().kind()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue