Closed
Description
This crate
fn noret() -> ! { loop { } }
pub fn test_noret() -> () { noret() }
when compiled without optimization (rustc --crate-type rlib --emit asm
), produces
_ZN4test5noret17hecd4eea31d87a48aE:
.cfi_startproc
jmp .LBB0_1
.LBB0_1:
jmp .LBB0_1
.Lfunc_end0:
.size _ZN4test5noret17hecd4eea31d87a48aE, .Lfunc_end0-_ZN4test5noret17hecd4eea31d87a48aE
.cfi_endproc
_ZN4test10test_noret17h492e3702bacafd6bE:
.cfi_startproc
pushq %rax
.Lcfi0:
.cfi_def_cfa_offset 16
callq _ZN4test5noret17hecd4eea31d87a48aE
.Lfunc_end1:
.size _ZN4test10test_noret17h492e3702bacafd6bE, .Lfunc_end1-_ZN4test10test_noret17h492e3702bacafd6bE
.cfi_endproc
but when compiled with optimization on (rustc --crate-type rlib --emit asm -O
), no assembly instructions at all are emitted for test_noret
:
_ZN4test10test_noret17h492e3702bacafd6bE:
.cfi_startproc
.Lfunc_end0:
.size _ZN4test10test_noret17h492e3702bacafd6bE, .Lfunc_end0-_ZN4test10test_noret17h492e3702bacafd6bE
.cfi_endproc
I expected to get something like
_ZN4test10test_noret17h492e3702bacafd6bE:
.cfi_startproc
.LBB0_1:
jmp .LBB0_1
.Lfunc_end0:
.size _ZN4test10test_noret17h492e3702bacafd6bE, .Lfunc_end0-_ZN4test10test_noret17h492e3702bacafd6bE
.cfi_endproc
Identical behavior observed with rustc 1.17.0 (56124baa9 2017-04-24)
and rustc 1.19.0-nightly (386b0b9d3 2017-05-14)
.