Skip to content

Commit

Permalink
add tests for -Zlocation-detail
Browse files Browse the repository at this point in the history
  • Loading branch information
hudson-ayers committed Oct 21, 2021
1 parent 8090f67 commit b802629
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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));
Expand Down
7 changes: 7 additions & 0 deletions src/test/ui/panics/location-detail-panic-no-column.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// run-fail
// check-run-results
// compile-flags: -Zlocation-detail=line,file

fn main() {
panic!("column-redacted");
}
2 changes: 2 additions & 0 deletions src/test/ui/panics/location-detail-panic-no-column.run.stderr
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions src/test/ui/panics/location-detail-panic-no-file.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// run-fail
// check-run-results
// compile-flags: -Zlocation-detail=line,column

fn main() {
panic!("file-redacted");
}
2 changes: 2 additions & 0 deletions src/test/ui/panics/location-detail-panic-no-file.run.stderr
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions src/test/ui/panics/location-detail-panic-no-line.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// run-fail
// check-run-results
// compile-flags: -Zlocation-detail=file,column

fn main() {
panic!("line-redacted");
}
2 changes: 2 additions & 0 deletions src/test/ui/panics/location-detail-panic-no-line.run.stderr
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions src/test/ui/panics/location-detail-unwrap-no-file.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// run-fail
// check-run-results
// compile-flags: -Zlocation-detail=line,column

fn main() {
let opt: Option<u32> = None;
opt.unwrap();
}
2 changes: 2 additions & 0 deletions src/test/ui/panics/location-detail-unwrap-no-file.run.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b802629

Please sign in to comment.