]> git.lizzy.rs Git - rust.git/commit
Ensure main() always has external linkage
authorvarkor <github@varkor.com>
Sun, 25 Feb 2018 23:05:06 +0000 (23:05 +0000)
committervarkor <github@varkor.com>
Sun, 25 Feb 2018 23:05:06 +0000 (23:05 +0000)
commit24666443898c142944b4156c22d04130b9db645b
tree090263145bac47a56886a6b34dfd46250809e816
parent026339e42ba11a559767029d933d1197aefb877a
Ensure main() always has external linkage

This ensures that the entry function is never elided due to inlining, even with `inline(always)`. Fixes #47783.

There were a couple of possible ways of addressing this issue; I simply picked the one that seemed most direct. A warning could be appropriate, but considering using inlining hints in other places it doesn't apply also throws no warnings, and it seems like an edge case anyway, I haven't added one for now.
src/librustc_mir/monomorphize/item.rs
src/test/run-pass/inlined-main.rs [new file with mode: 0644]