Under some circumstances, rustc emits debug information with missing line numbers for calls to diverging functions.
fn main() {
if True == False {
// unreachable
diverge();
}
diverge();
}
#[derive(PartialEq)]
pub enum MyBool {
True,
False,
}
use MyBool::*;
fn diverge() -> ! {
panic!();
}
Compiling with rustc main.rs -g --emit=llvm-ir -Clto and then inspecting the debug info for main in the .ll file, the line information is 0:
call void @_ZN4main7diverge17h595c254fa559ce50E(), !dbg !3943
!3943 = !DILocation(line: 0, scope: !3942)
If the unreachable call is removed, the line info matches the source file as expected:
!4340 = !DILocation(line: 16, column: 4, scope: !4338)
I get the same behavior with the latest stable
rustc 1.33.0 (2aa4c46cf 2019-02-28)
binary: rustc
commit-hash: 2aa4c46cfdd726e97360c2734835aa3515e8c858
commit-date: 2019-02-28
host: x86_64-unknown-linux-gnu
release: 1.33.0
LLVM version: 8.0
and with the latest nightly
rustc 1.35.0-nightly (237bf3244 2019-03-28)
binary: rustc
commit-hash: 237bf3244fffef501cf37d4bda00e1fce3fcfb46
commit-date: 2019-03-28
host: x86_64-unknown-linux-gnu
release: 1.35.0-nightly
LLVM version: 8.0
cc @japaric
Under some circumstances,
rustcemits debug information with missing line numbers for calls to diverging functions.Compiling with
rustc main.rs -g --emit=llvm-ir -Cltoand then inspecting the debug info formainin the.llfile, the line information is 0:If the unreachable call is removed, the line info matches the source file as expected:
I get the same behavior with the latest stable
and with the latest nightly
cc @japaric