1
Fork 0

Ensure nested allocations in statics do not get deduplicated

This commit is contained in:
Oli Scherer 2024-02-26 18:03:06 +00:00
parent 92414ab25d
commit d3514a036d
21 changed files with 259 additions and 54 deletions

View file

@ -380,8 +380,12 @@ fn collect_items_rec<'tcx>(
// Sanity check whether this ended up being collected accidentally
debug_assert!(should_codegen_locally(tcx, &instance));
let ty = instance.ty(tcx, ty::ParamEnv::reveal_all());
visit_drop_use(tcx, ty, true, starting_item.span, &mut used_items);
let DefKind::Static { nested, .. } = tcx.def_kind(def_id) else { bug!() };
// Nested statics have no type.
if !nested {
let ty = instance.ty(tcx, ty::ParamEnv::reveal_all());
visit_drop_use(tcx, ty, true, starting_item.span, &mut used_items);
}
recursion_depth_reset = None;