]> git.lizzy.rs Git - rust.git/commitdiff
Check for main in current module before codegen of entry wrapper
authorbjorn3 <bjorn3@users.noreply.github.com>
Sat, 7 Mar 2020 11:13:54 +0000 (12:13 +0100)
committerbjorn3 <bjorn3@users.noreply.github.com>
Sat, 7 Mar 2020 11:13:54 +0000 (12:13 +0100)
src/main_shim.rs

index fc3f9734874e64fab215d5dc5918d0ae90a1e1c2..74ee0d8fee81b064696b38b1960ee6edb8ef469c 100644 (file)
@@ -17,6 +17,11 @@ pub fn maybe_create_entry_wrapper(tcx: TyCtxt<'_>, module: &mut Module<impl Back
         None => return,
     };
 
+    let instance = Instance::mono(tcx, main_def_id);
+    if module.get_name(&*tcx.symbol_name(instance).name.as_str()).is_none() {
+        return;
+    }
+
     create_entry_fn(tcx, module, main_def_id, use_start_lang_item);
 
     fn create_entry_fn(