about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2024-04-19 20:55:59 -0400
committerAntoni Boucher <bouanto@zoho.com>2024-04-19 20:55:59 -0400
commit7cd561efd6e8097bb9075dbf05a2cd8d37696cb8 (patch)
treebd30f5581106d6e784f91d70ceb4c9900fe4d2a8 /src
parentab7d138d1675939bd87ad9bd14bf1fc78d41edcd (diff)
downloadrust-7cd561efd6e8097bb9075dbf05a2cd8d37696cb8.tar.gz
rust-7cd561efd6e8097bb9075dbf05a2cd8d37696cb8.zip
Fix check for main function already declared
Diffstat (limited to 'src')
-rw-r--r--src/context.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/context.rs b/src/context.rs
index 1b9cfd3652c..d37fa7833fc 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -526,7 +526,7 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
 
     fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
         let entry_name = self.sess().target.entry_name.as_ref();
-        if self.get_declared_value(entry_name).is_none() {
+        if !self.functions.borrow().contains_key(entry_name) {
             Some(self.declare_entry_fn(entry_name, fn_type, ()))
         } else {
             // If the symbol already exists, it is an error: for example, the user wrote