From c4eb07761643d2fa26d6f609eb23c8d22e14d8eb Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Thu, 17 Jul 2025 18:41:52 -0400 Subject: Ensure we codegen and don't internalize the entrypoint --- compiler/rustc_monomorphize/src/collector.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'compiler/rustc_monomorphize/src/collector.rs') diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 91c8e64ce9a..5071f9f8922 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -1582,6 +1582,15 @@ impl<'v> RootCollector<'_, 'v> { return; }; + let main_instance = Instance::mono(self.tcx, main_def_id); + if self.tcx.should_codegen_locally(main_instance) { + self.output.push(create_fn_mono_item( + self.tcx, + main_instance, + self.tcx.def_span(main_def_id), + )); + } + let Some(start_def_id) = self.tcx.lang_items().start_fn() else { self.tcx.dcx().emit_fatal(errors::StartNotFound); }; -- cgit 1.4.1-3-g733a5