rust/src/test/ui/duplicate/dupe-symbols-8.rs
jumbatm a796af7a76 Fail on multiple declarations of main.
Previously, when inserting the entry function, we only checked for
duplicate _definitions_ of `main`.  However, it's possible to cause
problems even only having a duplicate _declaration_. For example,
shadowing `main` using an extern block isn't caught by the current
check, and causes an assertion failure down the line in in LLVM code.
2020-02-23 02:06:11 +10:00

13 lines
194 B
Rust

// build-fail
// error-pattern: entry symbol `main` declared multiple times
//
// See #67946.
#![allow(warnings)]
fn main() {
extern "Rust" {
fn main();
}
unsafe { main(); }
}