Rename asm noreturn and deprecate old option

the noreturn option in asm! is poorly named, making it very confusing that the correct way to write a #[naked] function is:

#[naked]
pub unsafe extern "C" fn my_fn() {
    asm!("ret", options(noreturn));
}

where the asm! block has to be marked noreturn because it returns from the function.

I suggest deprecating noreturn and naming the new replacement option diverges or diverging:

#[naked]
pub unsafe extern "C" fn my_fn() {
    asm!("ret", options(diverges));
}

This was originally suggested on Zulip by @digama0 afaict: rust-lang

7 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.