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

ICE: build cache corruption #49663

Closed
elinorbgr opened this issue Apr 4, 2018 · 6 comments · Fixed by #49833
Closed

ICE: build cache corruption #49663

elinorbgr opened this issue Apr 4, 2018 · 6 comments · Fixed by #49833
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@elinorbgr
Copy link
Contributor

elinorbgr commented Apr 4, 2018

Sorry, the testcase is not exactly simple, but:

diff --git a/wayland-server/src/lib.rs b/wayland-server/src/lib.rs
index 8685ab04..f83909dd 100644
--- a/wayland-server/src/lib.rs
+++ b/wayland-server/src/lib.rs
@@ -1,3 +1,5 @@
+#![warn(missing_docs)]
+
 #[macro_use]
 extern crate bitflags;
 extern crate libc;
  • re-run cargo +beta test --all --all-features
  • ICE :
error: internal compiler error: librustc/ty/context.rs:998: tried to cache DefId(20/0:393 ~ wayland_server[52b1]::generated[0]::c_interfaces[0]::wl_surface_interface[0]), but was already existing as AllocId(
    451
)
  • run cargo clean
  • re-run cargo +beta test --all --all-features
  • builds and run fine
$ rustc +beta --version
rustc 1.26.0-beta.1 (18aaa1d2c 2018-04-03)
$cargo +beta --version
cargo 1.26.0-beta (d63299b6e 2018-03-28)

Does not reproduce on stable 1.25, reproduces on nightly as well.

@oli-obk oli-obk self-assigned this Apr 4, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Apr 4, 2018

Do you have a generated Wayland_c_interfaces.rs at hand? If not I'll have a look tomorrow

@elinorbgr
Copy link
Contributor Author

@pietroalbini pietroalbini added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 5, 2018
@oli-obk oli-obk added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Apr 5, 2018
@alexcrichton alexcrichton added this to the 1.26 milestone Apr 5, 2018
@nikomatsakis
Copy link
Contributor

triage: P-high

Regression, @oli-obk is on it.

@oli-obk oli-obk added the P-high High priority label Apr 5, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Apr 7, 2018

I don't have a minimal repro yet, but it looks very much like this is only happening cross crate.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 8, 2018

Minimized (probably not minimal) repro:

// a.rs
pub const FOO: *const i8 = 0 as *const i8;

pub static mut BAR: [*const i8; 4] = [FOO, FOO, FOO, FOO];

pub static mut BAA: (*const i8, i32, *const i8) = (
    unsafe { &BAR as *const _ as *const i8 },
    42,
    unsafe { &BOO as *const _ as *const i8 },
);
pub static mut BOO: (*const i8, *const i8, u32) = (
    unsafe { &BAA as *const _ as *const i8 },
    &FOO as *const _ as *const i8,
    99,
);

// b.rs
extern crate a;

static mut BOO: *const i32 = unsafe { &a::BOO as *const _ as *const i32 };

fn main() {}

Adding an empty line to the beginning of a.rs causes another symptom of this bug.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 9, 2018

Fully minimized

pub static mut BAA: *const i8 = unsafe { &BOO as *const _ as *const i8 };
pub static mut BOO: *const i8 = unsafe { &BAA as *const _ as *const i8 };
fn main() {}

Adding an empty line to the beginning of the file causes an ICE.

The only possible fix I see is to add the previously discussed interpret-alloc-table that'll get cached via the footer instead of trying to do everything inline

bors added a commit that referenced this issue Apr 15, 2018
…woerister

Don't recurse into allocations, use a global table instead

r? @michaelwoerister

fixes #49663
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants