1
Fork 0

Fix cases where std accidentally relied on inline(never)

This commit is contained in:
Ben Kimock 2023-12-09 00:48:17 -05:00
parent 2b399b5275
commit e559172249
4 changed files with 37 additions and 11 deletions

View file

@ -212,11 +212,17 @@ where
let cgu_name_cache = &mut FxHashMap::default();
for mono_item in mono_items {
// Handle only root items directly here. Inlined items are handled at
// the bottom of the loop based on reachability.
// Handle only root (GloballyShared) items directly here. Inlined (LocalCopy) items
// are handled at the bottom of the loop based on reachability, with one exception.
// The #[lang = "start"] item is the program entrypoint, so there are no calls to it in MIR.
// So even if its mode is LocalCopy, we need to treat it like a root.
match mono_item.instantiation_mode(cx.tcx) {
InstantiationMode::GloballyShared { .. } => {}
InstantiationMode::LocalCopy => continue,
InstantiationMode::LocalCopy => {
if Some(mono_item.def_id()) != cx.tcx.lang_items().start_fn() {
continue;
}
}
}
let characteristic_def_id = characteristic_def_id_of_mono_item(cx.tcx, mono_item);