Skip to content

Commit

Permalink
Fix runtime build on current nightly
Browse files Browse the repository at this point in the history
libstd’s runtime changed the prototype of lang = "start" in
ddee45e1d7fd34563c13513d974f792fae41a2f7 to support changing the SIGPIPE
behaviour on Linux, so this function now takes a third argument on every
platform.

Additionally, it now supports user_main() returning any Termination, so
we don’t need a transmute() any longer. :)
  • Loading branch information
linkmauve committed Apr 21, 2023
1 parent 8656459 commit a6b266c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions luma_runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ global_asm!(include_str!("../asm/system.S"));
/// This is the executable start function, which directly follows the entry point.
#[cfg_attr(not(test), lang = "start")]
#[cfg(not(test))]
fn start<T>(user_main: fn(), _argc: isize, _argv: *const *const u8) -> isize
fn start<T>(user_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize
where
T: Termination,
{
Expand All @@ -54,7 +54,6 @@ where
}

// Jump to user defined main function.
let user_main: fn() -> T = unsafe { core::mem::transmute(user_main) };
user_main();

panic!("main() cannot return");
Expand Down

0 comments on commit a6b266c

Please sign in to comment.