add tests for -Zlocation-detail

This commit is contained in:
Hudson Ayers 2021-10-15 08:58:28 -07:00
parent 8090f67fb7
commit b802629311
9 changed files with 41 additions and 1 deletions

View File

@ -5,7 +5,9 @@ use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig};
use rustc_session::config::InstrumentCoverage;
use rustc_session::config::Strip;
use rustc_session::config::{build_configuration, build_session_options, to_crate_config};
use rustc_session::config::{rustc_optgroups, ErrorOutputType, ExternLocation, Options, Passes};
use rustc_session::config::{
rustc_optgroups, ErrorOutputType, ExternLocation, LocationDetail, Options, Passes,
};
use rustc_session::config::{CFGuard, ExternEntry, LinkerPluginLto, LtoCli, SwitchWithOptPath};
use rustc_session::config::{
Externs, OutputType, OutputTypes, SymbolManglingVersion, WasiExecModel,
@ -733,6 +735,7 @@ fn test_debugging_options_tracking_hash() {
tracked!(instrument_mcount, true);
tracked!(link_only, true);
tracked!(llvm_plugins, vec![String::from("plugin_name")]);
tracked!(location_detail, LocationDetail { file: true, line: false, column: false });
tracked!(merge_functions, Some(MergeFunctions::Disabled));
tracked!(mir_emit_retag, true);
tracked!(mir_opt_level, Some(4));

View File

@ -0,0 +1,7 @@
// run-fail
// check-run-results
// compile-flags: -Zlocation-detail=line,file
fn main() {
panic!("column-redacted");
}

View File

@ -0,0 +1,2 @@
thread 'main' panicked at 'column-redacted', $DIR/location-detail-panic-no-column.rs:6:0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View File

@ -0,0 +1,7 @@
// run-fail
// check-run-results
// compile-flags: -Zlocation-detail=line,column
fn main() {
panic!("file-redacted");
}

View File

@ -0,0 +1,2 @@
thread 'main' panicked at 'file-redacted', <redacted>:6:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View File

@ -0,0 +1,7 @@
// run-fail
// check-run-results
// compile-flags: -Zlocation-detail=file,column
fn main() {
panic!("line-redacted");
}

View File

@ -0,0 +1,2 @@
thread 'main' panicked at 'line-redacted', $DIR/location-detail-panic-no-line.rs:0:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View File

@ -0,0 +1,8 @@
// run-fail
// check-run-results
// compile-flags: -Zlocation-detail=line,column
fn main() {
let opt: Option<u32> = None;
opt.unwrap();
}

View File

@ -0,0 +1,2 @@
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', <redacted>:7:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace