diff options
| author | Jubilee <46493976+workingjubilee@users.noreply.github.com> | 2024-07-12 13:47:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-12 13:47:05 -0700 |
| commit | 5d56572f06eb55d4e270663e03649d5fed4258d2 (patch) | |
| tree | 484cacc25e054eb8c416b264eab4f1c23c9632c3 /compiler | |
| parent | 62c068feeafd1f4abbf87243d69cf8862e4dd277 (diff) | |
| parent | 7c3673ff6f2ff4e8e85344c091c9feb4b5da1290 (diff) | |
| download | rust-5d56572f06eb55d4e270663e03649d5fed4258d2.tar.gz rust-5d56572f06eb55d4e270663e03649d5fed4258d2.zip | |
Rollup merge of #126502 - cuviper:dump-mir-exclude-alloc-bytes, r=estebank
Ignore allocation bytes in some mir-opt tests This adds `rustc -Zdump-mir-exclude-alloc-bytes` to skip writing allocation bytes in MIR dumps, and applies it to tests that were failing on s390x due to its big-endian byte order. Fixes #126261
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_interface/src/tests.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/pretty.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index e2ba75dfd19..7d7a6a08bee 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -691,6 +691,7 @@ fn test_unstable_options_tracking_hash() { untracked!(dump_mir, Some(String::from("abc"))); untracked!(dump_mir_dataflow, true); untracked!(dump_mir_dir, String::from("abc")); + untracked!(dump_mir_exclude_alloc_bytes, true); untracked!(dump_mir_exclude_pass_number, true); untracked!(dump_mir_graphviz, true); untracked!(dump_mono_stats, SwitchWithOptPath::Enabled(Some("mono-items-dir/".into()))); diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 82625ae3d47..223249952dc 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -1545,6 +1545,9 @@ impl<'a, 'tcx, Prov: Provenance, Extra, Bytes: AllocBytes> std::fmt::Display // We are done. return write!(w, " {{}}"); } + if tcx.sess.opts.unstable_opts.dump_mir_exclude_alloc_bytes { + return write!(w, " {{ .. }}"); + } // Write allocation bytes. writeln!(w, " {{")?; write_allocation_bytes(tcx, alloc, w, " ")?; diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 7421cae65e4..68f3ff13d2e 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1687,6 +1687,8 @@ options! { (default: no)"), dump_mir_dir: String = ("mir_dump".to_string(), parse_string, [UNTRACKED], "the directory the MIR is dumped into (default: `mir_dump`)"), + dump_mir_exclude_alloc_bytes: bool = (false, parse_bool, [UNTRACKED], + "exclude the raw bytes of allocations when dumping MIR (used in tests) (default: no)"), dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED], "exclude the pass number when dumping MIR (used in tests) (default: no)"), dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED], |
