diff options
| author | Charles Lew <crlf0710@gmail.com> | 2021-04-26 01:09:35 +0800 |
|---|---|---|
| committer | Charles Lew <crlf0710@gmail.com> | 2021-04-29 08:35:08 +0800 |
| commit | d261df4a72e60e8baa0f21b67eba8f7b91cc2135 (patch) | |
| tree | 4547e05f08c17033fdc8da3d03415010f213d82c /compiler/rustc_mir | |
| parent | 727d101561f9b1e81c6282943292d990288ca479 (diff) | |
| download | rust-d261df4a72e60e8baa0f21b67eba8f7b91cc2135.tar.gz rust-d261df4a72e60e8baa0f21b67eba8f7b91cc2135.zip | |
Implement RFC 1260 with feature_name `imported_main`.
Diffstat (limited to 'compiler/rustc_mir')
| -rw-r--r-- | compiler/rustc_mir/src/monomorphize/collector.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_mir/src/monomorphize/collector.rs b/compiler/rustc_mir/src/monomorphize/collector.rs index e621bc9167d..fdefc890674 100644 --- a/compiler/rustc_mir/src/monomorphize/collector.rs +++ b/compiler/rustc_mir/src/monomorphize/collector.rs @@ -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 |
