Auto merge of #107267 - cjgillot:keep-aggregate, r=oli-obk
Do not deaggregate MIR This turns out to simplify a lot of things. I haven't checked the consequences for miri yet. cc `@JakobDegen` r? `@oli-obk`
This commit is contained in:
commit
9dee4e4c42
114 changed files with 659 additions and 1040 deletions
|
@ -2098,10 +2098,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
|||
AggregateKind::Closure(def_id, substs) => ty::tls::with(|tcx| {
|
||||
let name = if tcx.sess.opts.unstable_opts.span_free_formats {
|
||||
let substs = tcx.lift(substs).unwrap();
|
||||
format!(
|
||||
"[closure@{}]",
|
||||
tcx.def_path_str_with_substs(def_id.to_def_id(), substs),
|
||||
)
|
||||
format!("[closure@{}]", tcx.def_path_str_with_substs(def_id, substs),)
|
||||
} else {
|
||||
let span = tcx.def_span(def_id);
|
||||
format!(
|
||||
|
@ -2112,11 +2109,17 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
|||
let mut struct_fmt = fmt.debug_struct(&name);
|
||||
|
||||
// FIXME(project-rfc-2229#48): This should be a list of capture names/places
|
||||
if let Some(upvars) = tcx.upvars_mentioned(def_id) {
|
||||
if let Some(def_id) = def_id.as_local()
|
||||
&& let Some(upvars) = tcx.upvars_mentioned(def_id)
|
||||
{
|
||||
for (&var_id, place) in iter::zip(upvars.keys(), places) {
|
||||
let var_name = tcx.hir().name(var_id);
|
||||
struct_fmt.field(var_name.as_str(), place);
|
||||
}
|
||||
} else {
|
||||
for (index, place) in places.iter().enumerate() {
|
||||
struct_fmt.field(&format!("{index}"), place);
|
||||
}
|
||||
}
|
||||
|
||||
struct_fmt.finish()
|
||||
|
@ -2127,11 +2130,17 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
|||
let mut struct_fmt = fmt.debug_struct(&name);
|
||||
|
||||
// FIXME(project-rfc-2229#48): This should be a list of capture names/places
|
||||
if let Some(upvars) = tcx.upvars_mentioned(def_id) {
|
||||
if let Some(def_id) = def_id.as_local()
|
||||
&& let Some(upvars) = tcx.upvars_mentioned(def_id)
|
||||
{
|
||||
for (&var_id, place) in iter::zip(upvars.keys(), places) {
|
||||
let var_name = tcx.hir().name(var_id);
|
||||
struct_fmt.field(var_name.as_str(), place);
|
||||
}
|
||||
} else {
|
||||
for (index, place) in places.iter().enumerate() {
|
||||
struct_fmt.field(&format!("{index}"), place);
|
||||
}
|
||||
}
|
||||
|
||||
struct_fmt.finish()
|
||||
|
|
|
@ -1203,10 +1203,8 @@ pub enum AggregateKind<'tcx> {
|
|||
/// active field index would identity the field `c`
|
||||
Adt(DefId, VariantIdx, SubstsRef<'tcx>, Option<UserTypeAnnotationIndex>, Option<usize>),
|
||||
|
||||
// Note: We can use LocalDefId since closures and generators a deaggregated
|
||||
// before codegen.
|
||||
Closure(LocalDefId, SubstsRef<'tcx>),
|
||||
Generator(LocalDefId, SubstsRef<'tcx>, hir::Movability),
|
||||
Closure(DefId, SubstsRef<'tcx>),
|
||||
Generator(DefId, SubstsRef<'tcx>, hir::Movability),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
||||
|
|
|
@ -205,9 +205,9 @@ impl<'tcx> Rvalue<'tcx> {
|
|||
AggregateKind::Adt(did, _, substs, _, _) => {
|
||||
tcx.bound_type_of(did).subst(tcx, substs)
|
||||
}
|
||||
AggregateKind::Closure(did, substs) => tcx.mk_closure(did.to_def_id(), substs),
|
||||
AggregateKind::Closure(did, substs) => tcx.mk_closure(did, substs),
|
||||
AggregateKind::Generator(did, substs, movability) => {
|
||||
tcx.mk_generator(did.to_def_id(), substs, movability)
|
||||
tcx.mk_generator(did, substs, movability)
|
||||
}
|
||||
},
|
||||
Rvalue::ShallowInitBox(_, ty) => tcx.mk_box(ty),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue