diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 933a32392bddf..e19dc67c49542 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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); diff --git a/tests/codegen/diverging-function-call-debuginfo.rs b/tests/codegen/diverging-function-call-debuginfo.rs new file mode 100644 index 0000000000000..49a5b2fffa8e9 --- /dev/null +++ b/tests/codegen/diverging-function-call-debuginfo.rs @@ -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 . + +//@ 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]]