Skip to content

Commit

Permalink
Merge pull request #497 from rust-lang/fix/add-block-to-imported-main…
Browse files Browse the repository at this point in the history
…-function

Fix check for main function already declared
  • Loading branch information
antoyo authored Apr 20, 2024
2 parents ab7d138 + 7cd561e commit e26e7ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e26e7ae

Please sign in to comment.