Skip to content

Commit 52abafa

Browse files
Rollup merge of #42017 - nikomatsakis:issue-41677, r=arielb1
avoid cycles in mir-dump, take 2 This fixes #41697, for real this time, but I'm not sure how best to add a regression test. I was considering maybe adding some flag so that the MIR dumping doesn't actually get written to files (e.g., overloading the directory flag so you can specify nil or something). cc @dwrensha @oli-obk
2 parents 4066c8e + c9f9bc2 commit 52abafa

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/librustc/ty/maps.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ macro_rules! define_map_struct {
592592
output: $output:tt) => {
593593
define_map_struct! {
594594
tcx: $tcx,
595-
ready: ([pub] $attrs $name),
595+
ready: ([] $attrs $name),
596596
input: ($($input)*),
597597
output: $output
598598
}

src/librustc_mir/util/pretty.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut Write)
324324
MirSource::Promoted(_, i) => write!(w, "{:?} in", i)?
325325
}
326326

327-
write!(w, " {}", tcx.node_path_str(src.item_id()))?;
327+
item_path::with_forced_impl_filename_line(|| { // see notes on #41697 elsewhere
328+
write!(w, " {}", tcx.node_path_str(src.item_id()))
329+
})?;
328330

329331
if let MirSource::Fn(_) = src {
330332
write!(w, "(")?;

src/test/run-pass/issue-41697.rs renamed to src/test/mir-opt/issue-41697.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags:-Zdump-mir=NEVER_MATCHED
12-
1311
// Regression test for #41697. Using dump-mir was triggering
1412
// artificial cycles: during type-checking, we had to get the MIR for
1513
// the constant expressions in `[u8; 2]`, which in turn would trigger

0 commit comments

Comments
 (0)