• Mazdak Farrokhzad's avatar
    Rollup merge of #59639 - cuviper:ignore-uninhabited, r=eddyb · 05c31baf
    Mazdak Farrokhzad authored
    Never return uninhabited values at all
    Functions with uninhabited return values are already marked `noreturn`,
    but we were still generating return instructions for this. When running
    with `-C passes=lint`, LLVM prints:
        Unusual: Return statement in function with noreturn attribute
    The LLVM manual makes a stronger statement about `noreturn` though:
    > This produces undefined behavior at runtime if the function ever does
    dynamically return.
    We now emit an `abort` anywhere that would have tried to return an
    uninhabited value.
    Fixes #48227
    cc #7463 #48229
    r? @eddyb
block.rs 47.7 KB