@@ -223,11 +223,7 @@ where
223
223
// So even if its mode is LocalCopy, we need to treat it like a root.
224
224
match mono_item. instantiation_mode ( cx. tcx ) {
225
225
InstantiationMode :: GloballyShared { .. } => { }
226
- InstantiationMode :: LocalCopy => {
227
- if !cx. tcx . is_lang_item ( mono_item. def_id ( ) , LangItem :: Start ) {
228
- continue ;
229
- }
230
- }
226
+ InstantiationMode :: LocalCopy => continue ,
231
227
}
232
228
233
229
let characteristic_def_id = characteristic_def_id_of_mono_item ( cx. tcx , mono_item) ;
@@ -821,10 +817,9 @@ fn mono_item_visibility<'tcx>(
821
817
| InstanceKind :: FnPtrAddrShim ( ..) => return Visibility :: Hidden ,
822
818
} ;
823
819
824
- // The `start_fn` lang item is actually a monomorphized instance of a
825
- // function in the standard library, used for the `main` function. We don't
826
- // want to export it so we tag it with `Hidden` visibility but this symbol
827
- // is only referenced from the actual `main` symbol which we unfortunately
820
+ // Both the `start_fn` lang item and `main` itself should not be exported,
821
+ // so we give them with `Hidden` visibility but these symbols are
822
+ // only referenced from the actual `main` symbol which we unfortunately
828
823
// don't know anything about during partitioning/collection. As a result we
829
824
// forcibly keep this symbol out of the `internalization_candidates` set.
830
825
//
@@ -834,7 +829,7 @@ fn mono_item_visibility<'tcx>(
834
829
// from the `main` symbol we'll generate later.
835
830
//
836
831
// This may be fixable with a new `InstanceKind` perhaps? Unsure!
837
- if tcx. is_lang_item ( def_id, LangItem :: Start ) {
832
+ if tcx. is_entrypoint ( def_id) {
838
833
* can_be_internalized = false ;
839
834
return Visibility :: Hidden ;
840
835
}
0 commit comments