Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in -Z dump-mir=all #41697

Closed
oli-obk opened this issue May 2, 2017 · 12 comments · Fixed by #41777 or #42017
Closed

Regression in -Z dump-mir=all #41697

oli-obk opened this issue May 2, 2017 · 12 comments · Fixed by #41777 or #42017

Comments

@oli-obk
Copy link
Contributor

oli-obk commented May 2, 2017

running rustc -Z dump-mir=all src/test/run-pass/issue-33387.rs

yields

error[E0391]: unsupported cyclic reference between types/traits detected
  --> ../rust/src/test/run-pass/issue-33387.rs:19:1
   |
19 | / impl Foo for [u8; 2] {
20 | |     fn get(&self) -> [u8; 2] {
21 | |         *self
22 | |     }
23 | | }
   | |_^ cyclic reference
   |
note: the cycle begins when processing `<impl at ../rust/src/test/run-pass/issue-33387.rs:19:1: 23:2>`...
  --> ../rust/src/test/run-pass/issue-33387.rs:19:1
   |
19 | / impl Foo for [u8; 2] {
20 | |     fn get(&self) -> [u8; 2] {
21 | |         *self
22 | |     }
23 | | }
   | |_^
note: ...which then requires const-evaluating `<impl at ../rust/src/test/run-pass/issue-33387.rs:19:1: 23:2>::{{initializer}}`...
  --> ../rust/src/test/run-pass/issue-33387.rs:19:19
   |
19 | impl Foo for [u8; 2] {
   |                   ^
note: ...which then requires processing `<impl at ../rust/src/test/run-pass/issue-33387.rs:19:1: 23:2>::{{initializer}}`...
  --> ../rust/src/test/run-pass/issue-33387.rs:19:19
   |
19 | impl Foo for [u8; 2] {
   |                   ^
note: ...which then requires processing `<impl at ../rust/src/test/run-pass/issue-33387.rs:19:1: 23:2>::{{initializer}}`...
  --> ../rust/src/test/run-pass/issue-33387.rs:19:19
   |
19 | impl Foo for [u8; 2] {
   |                   ^
note: ...which then requires processing `<impl at ../rust/src/test/run-pass/issue-33387.rs:19:1: 23:2>`...
  --> ../rust/src/test/run-pass/issue-33387.rs:19:1
   |
19 | / impl Foo for [u8; 2] {
20 | |     fn get(&self) -> [u8; 2] {
21 | |         *self
22 | |     }
23 | | }
   | |_^
   = note: ...which then again requires processing `<impl at ../rust/src/test/run-pass/issue-33387.rs:19:1: 23:2>`, completing the cycle.

Happening on rustc 1.19.0-nightly (777ee2079 2017-05-01). Did not happen on the latest nightly available through rustup on 27.04.2017.

@est31
Copy link
Member

est31 commented May 2, 2017

Last working nightly: rustc 1.18.0-nightly (94e884b63 2017-04-27)
First broken nightly: rustc 1.18.0-nightly (128aa262e 2017-04-28)
list of commits in between.

@est31
Copy link
Member

est31 commented May 2, 2017

maybe it was #41368 ? cc @nikomatsakis

@nikomatsakis
Copy link
Contributor

could be. let me try it on my big MIR refactoring branch =)

@dwrensha
Copy link
Contributor

dwrensha commented May 2, 2017

I confirm that the error occurs at 128aa26 but not at ad1461e. So it looks to me like #41368 is indeed the culprit.

@nikomatsakis
Copy link
Contributor

Yes. I can reproduce. Will investigate.

@nikomatsakis
Copy link
Contributor

I see the problem. PR coming soon.

@nikomatsakis
Copy link
Contributor

Fix at #41777

bors added a commit that referenced this issue May 9, 2017
…elb1

dump-mir was causing cycles by invoking item-path-str at bad times

Workaround for now, but probably a better fix is to opt **in** to using the types for impls (if we do that at all; maybe filename/line is better).

Fixes #41697
@dwrensha
Copy link
Contributor

I'm still seeing this issue, on the latest nightly and on master.

@nikomatsakis
Copy link
Contributor

@dwrensha can you give more details of how you are reproducing the problem? (I added a test for the precise scenario reported, so I'm reasonably sure it's not that case anymore.)

@dwrensha
Copy link
Contributor

$ rustc --version
rustc 1.19.0-nightly (978d2cfee 2017-05-10)
$ rustc -Z dump-mir=all src/test/run-pass/issue-33387.rs
error[E0391]: unsupported cyclic reference between types/traits detected
[...]

@nikomatsakis
Copy link
Contributor

Hmm, perhaps my regression test wasn't sufficient. I see I used -Zdump-mir=NEVER_MATCHED; I remember that the test did fail, but I guess that it passing doesn't prove all issues are resolved. =)

@dwrensha
Copy link
Contributor

The earliest commit where I can reproduce this problem is 2cca256.

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 16, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment