Skip to content

Commit b802629

Browse files
committed
add tests for -Zlocation-detail
1 parent 8090f67 commit b802629

9 files changed

+41
-1
lines changed

compiler/rustc_interface/src/tests.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig};
55
use rustc_session::config::InstrumentCoverage;
66
use rustc_session::config::Strip;
77
use rustc_session::config::{build_configuration, build_session_options, to_crate_config};
8-
use rustc_session::config::{rustc_optgroups, ErrorOutputType, ExternLocation, Options, Passes};
8+
use rustc_session::config::{
9+
rustc_optgroups, ErrorOutputType, ExternLocation, LocationDetail, Options, Passes,
10+
};
911
use rustc_session::config::{CFGuard, ExternEntry, LinkerPluginLto, LtoCli, SwitchWithOptPath};
1012
use rustc_session::config::{
1113
Externs, OutputType, OutputTypes, SymbolManglingVersion, WasiExecModel,
@@ -733,6 +735,7 @@ fn test_debugging_options_tracking_hash() {
733735
tracked!(instrument_mcount, true);
734736
tracked!(link_only, true);
735737
tracked!(llvm_plugins, vec![String::from("plugin_name")]);
738+
tracked!(location_detail, LocationDetail { file: true, line: false, column: false });
736739
tracked!(merge_functions, Some(MergeFunctions::Disabled));
737740
tracked!(mir_emit_retag, true);
738741
tracked!(mir_opt_level, Some(4));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// run-fail
2+
// check-run-results
3+
// compile-flags: -Zlocation-detail=line,file
4+
5+
fn main() {
6+
panic!("column-redacted");
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
thread 'main' panicked at 'column-redacted', $DIR/location-detail-panic-no-column.rs:6:0
2+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// run-fail
2+
// check-run-results
3+
// compile-flags: -Zlocation-detail=line,column
4+
5+
fn main() {
6+
panic!("file-redacted");
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
thread 'main' panicked at 'file-redacted', <redacted>:6:5
2+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// run-fail
2+
// check-run-results
3+
// compile-flags: -Zlocation-detail=file,column
4+
5+
fn main() {
6+
panic!("line-redacted");
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
thread 'main' panicked at 'line-redacted', $DIR/location-detail-panic-no-line.rs:0:5
2+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// run-fail
2+
// check-run-results
3+
// compile-flags: -Zlocation-detail=line,column
4+
5+
fn main() {
6+
let opt: Option<u32> = None;
7+
opt.unwrap();
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', <redacted>:7:9
2+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

0 commit comments

Comments
 (0)