Implement RFC 1260 with feature_name imported_main.

This commit is contained in:
Charles Lew
2021-04-26 01:09:35 +08:00
parent 727d101561
commit d261df4a72
38 changed files with 463 additions and 193 deletions

View File

@@ -1066,7 +1066,7 @@ struct RootCollector<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
mode: MonoItemCollectionMode,
output: &'a mut Vec<Spanned<MonoItem<'tcx>>>,
entry_fn: Option<(LocalDefId, EntryFnType)>,
entry_fn: Option<(DefId, EntryFnType)>,
}
impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
@@ -1154,7 +1154,7 @@ impl RootCollector<'_, 'v> {
&& match self.mode {
MonoItemCollectionMode::Eager => true,
MonoItemCollectionMode::Lazy => {
self.entry_fn.map(|(id, _)| id) == Some(def_id)
self.entry_fn.and_then(|(id, _)| id.as_local()) == Some(def_id)
|| self.tcx.is_reachable_non_generic(def_id)
|| self
.tcx