Skip to content

tests: Test line number in debuginfo for diverging function calls #144034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,7 @@ impl<'test> TestCx<'test> {
filecheck.arg("--allow-unused-prefixes");

// Provide more context on failures.
filecheck.args(&["--dump-input-context", "100"]);
filecheck.args(&["--dump-input-context", "1000000"]);

// Add custom flags supplied by the `filecheck-flags:` test directive.
filecheck.args(&self.props.filecheck_flags);
Expand Down
33 changes: 33 additions & 0 deletions tests/codegen/diverging-function-call-debuginfo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/// Make sure that line debuginfo is correct for diverging calls under certain
/// conditions. In particular we want to ensure that the line number is never
/// 0, but we check the absence of 0 by looking for the expected exact line
/// numbers. Regression test for <https://github.com/rust-lang/rust/issues/59558>.

//@ compile-flags: -g -Clto -Copt-level=0
//@ no-prefer-dynamic

fn main() {
if True == False {
// unreachable
// CHECK-DAG: [[UNREACHABLE_CALL_DBG:![0-9]+]] = !DILocation(line: [[@LINE+1]], column: 9, scope:
diverge();
}

// CHECK-DAG: [[LAST_CALL_DBG:![0-9]+]] = !DILocation(line: [[@LINE+1]], column: 5, scope:
diverge();
}

#[derive(PartialEq)]
pub enum MyBool {
True,
False,
}

use MyBool::*;

fn diverge() -> ! {
panic!();
}

// CHECK-DAG: call void {{.*}}diverging_function_call_debuginfo{{.*}}diverge{{.*}} !dbg [[LAST_CALL_DBG]]
// CHECK-DAG: call void {{.*}}diverging_function_call_debuginfo{{.*}}diverge{{.*}} !dbg [[UNREACHABLE_CALL_DBG]]
Loading