Skip to content

Commit

Permalink
Rollup merge of rust-lang#42017 - nikomatsakis:issue-41677, r=arielb1
Browse files Browse the repository at this point in the history
avoid cycles in mir-dump, take 2

This fixes rust-lang#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
  • Loading branch information
Mark-Simulacrum authored May 16, 2017
2 parents 4066c8e + c9f9bc2 commit 52abafa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/librustc/ty/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ macro_rules! define_map_struct {
output: $output:tt) => {
define_map_struct! {
tcx: $tcx,
ready: ([pub] $attrs $name),
ready: ([] $attrs $name),
input: ($($input)*),
output: $output
}
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_mir/util/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut Write)
MirSource::Promoted(_, i) => write!(w, "{:?} in", i)?
}

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

if let MirSource::Fn(_) = src {
write!(w, "(")?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags:-Zdump-mir=NEVER_MATCHED

// Regression test for #41697. Using dump-mir was triggering
// artificial cycles: during type-checking, we had to get the MIR for
// the constant expressions in `[u8; 2]`, which in turn would trigger
Expand Down

0 comments on commit 52abafa

Please sign in to comment.