1
Fork 0

Rollup merge of #139193 - compiler-errors:inline-synthetic, r=eholk

Feed HIR for by-move coroutine body def, since the inliner tries to read its attrs

See the comments in the test.

I'm surprised that nobody found this[^1] (edit: nvm haha), but you have to go out of your way to construct the by-move body and then inline it w/ a poll call, so I guess the inliner just never really gets into this situation before.

Fixes #134335

r? oli-obk

[^1]: Well, ````@eholk```` found this when working on the `iter! {}` macro, since it more dramatically affects those.
This commit is contained in:
Matthias Krüger 2025-04-01 20:25:24 +02:00 committed by GitHub
commit aafb17ddca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 12 deletions

View file

@ -219,6 +219,8 @@ pub(crate) fn coroutine_by_move_body_def_id<'tcx>(
mir::MirSource::from_instance(InstanceKind::Item(body_def.def_id().to_def_id()));
dump_mir(tcx, false, "built", &"after", &by_move_body, |_, _| Ok(()));
// Feed HIR because we try to access this body's attrs in the inliner.
body_def.feed_hir();
// Inherited from the by-ref coroutine.
body_def.codegen_fn_attrs(tcx.codegen_fn_attrs(coroutine_def_id).clone());
body_def.coverage_attr_on(tcx.coverage_attr_on(coroutine_def_id));