Rollup merge of #137977 - nnethercote:less-kw-Empty-1, r=spastorino

Reduce `kw::Empty` usage, part 1

This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way.

r? ```@spastorino```
This commit is contained in:
Matthias Krüger 2025-03-07 19:15:34 +01:00 committed by GitHub
commit 0defc4f27f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 125 additions and 83 deletions

View file

@ -78,7 +78,6 @@ use rustc_middle::hir::place::{Projection, ProjectionKind};
use rustc_middle::mir::visit::MutVisitor;
use rustc_middle::mir::{self, dump_mir};
use rustc_middle::ty::{self, InstanceKind, Ty, TyCtxt, TypeVisitableExt};
use rustc_span::kw;
pub(crate) fn coroutine_by_move_body_def_id<'tcx>(
tcx: TyCtxt<'tcx>,
@ -214,7 +213,7 @@ pub(crate) fn coroutine_by_move_body_def_id<'tcx>(
MakeByMoveBody { tcx, field_remapping, by_move_coroutine_ty }.visit_body(&mut by_move_body);
// This will always be `{closure#1}`, since the original coroutine is `{closure#0}`.
let body_def = tcx.create_def(parent_def_id, kw::Empty, DefKind::SyntheticCoroutineBody);
let body_def = tcx.create_def(parent_def_id, None, DefKind::SyntheticCoroutineBody);
by_move_body.source =
mir::MirSource::from_instance(InstanceKind::Item(body_def.def_id().to_def_id()));
dump_mir(tcx, false, "built", &"after", &by_move_body, |_, _| Ok(()));