Replace before-main logic with a syntax extension, use standard args for 'start' (main) #6322
Labels
A-runtime
Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
A-syntaxext
Area: Syntax extensions
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
Right now the compiler writes
main
as a wrapper that magically obtains the pointer to the Rustmain
function and to the crate map, then calls the runtimestart
function. Imagine something like:There are several reasons why this is not the best arrangement. One impact of this is that our most basic entry point,
start
, takes a thirdcrate_map
argument that must be supplied before main.We could turn this logic into a syntax extension, making the only real entry point
start
, taking argc and argv (types tbd).main
or#[main]
and, if it finds it, add a wrapper function,#[start] __start
.#[start]
.#[start]
.Related #3309
The text was updated successfully, but these errors were encountered: