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
This commit is contained in:
Mark Simulacrum 2017-05-16 17:31:50 -06:00 committed by GitHub
commit 52abafa464
3 changed files with 4 additions and 4 deletions

View File

@ -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
}

View File

@ -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, "(")?;

View File

@ -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