Skip to content

Commit e26e7ae

Browse files
authored
Merge pull request #497 from rust-lang/fix/add-block-to-imported-main-function
Fix check for main function already declared
2 parents ab7d138 + 7cd561e commit e26e7ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
526526

527527
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
528528
let entry_name = self.sess().target.entry_name.as_ref();
529-
if self.get_declared_value(entry_name).is_none() {
529+
if !self.functions.borrow().contains_key(entry_name) {
530530
Some(self.declare_entry_fn(entry_name, fn_type, ()))
531531
} else {
532532
// If the symbol already exists, it is an error: for example, the user wrote

0 commit comments

Comments
 (0)