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 with nightly on piston-examples #38790

Closed
martinlindhe opened this issue Jan 3, 2017 · 6 comments · Fixed by #38813
Closed

ICE with nightly on piston-examples #38790

martinlindhe opened this issue Jan 3, 2017 · 6 comments · Fixed by #38813
Assignees
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@martinlindhe
Copy link
Contributor

martinlindhe commented Jan 3, 2017

Details

OS: Windows 10 x64
rustc: rustc 1.16.0-nightly (4ecc85b 2016-12-28)
cargo: cargo 0.17.0-nightly (740f9c0 2016-12-29)

To reproduce

rustup default nightly
git clone https://github.com/PistonDevelopers/piston-examples
cd piston-examples
cargo build

Expected

With stable (rustc 1.14.0), the piston-examples does compile successfully.

Actual output

Running `rustc --crate-name deform src/deform.rs --crate-type bin -g -C metadata=6c9240b426d7b1af -C extra-filename=-6c9240b426d7b1af --out-dir C:\Users\name\dev\rs\piston-examples\target\debug\deps --emit=dep-info,link -L dependency=C:\Users\name\dev\rs\piston-examples\target\debug\deps --extern piston_window=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libpiston_window-0a1a60063703fb0e.rlib --extern shader_version=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libshader_version-6a60d77d44fb1501.rlib --extern find_folder=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libfind_folder-35f3d267b2482687.rlib --extern gfx=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libgfx-0410a72642285dd1.rlib --extern drag_controller=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libdrag_controller-b1828f35ec7eb32a.rlib --extern vecmath=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libvecmath-09f3ea6cbeda273e.rlib --extern camera_controllers=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libcamera_controllers-b9032432539dda45.rlib --extern sdl2_window=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libsdl2_window-ceb0a13f5a877d50.rlib --extern rand=C:\Users\name\dev\rs\piston-examples\target\debug\deps\librand-26cfd8d095643d5f.rlib --extern sprite=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libsprite-b68af5f2124a868d.rlib --extern image=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libimage-dacf166d5bac18b6.rlib --extern gfx_device_gl=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libgfx_device_gl-dc389d56cae94529.rlib --extern ai_behavior=C:\Users\name\dev\rs\piston-examples\target\debug\deps\libai_behavior-132db81e71637f11.rlib -L "native=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\lib\amd64" -L native=C:\Users\name\dev\rs\piston-examples\target\debug\build\miniz-sys-428121ff932ec089\out -L C:\Users\name\dev\rs\.cargo\sdl2-x64`
error: internal compiler error: C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\librustc\hir\map/mod.rs:395: node 605 is inlined but not present in map

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: run with `RUST_BACKTRACE=1` for a backtrace                                                                         

thread 'rustc' panicked at 'Box<Any>', C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\librustc_errors\lib.rs:423
stack backtrace:
0:     0x7ffe0eaafe3e - std::panicking::Location::line::h81feac86ecef9f31
1:     0x7ffe0eaaf2c2 - std::panicking::Location::line::h81feac86ecef9f31
2:     0x7ffe0eab2d1d - std::panicking::rust_panic_with_hook::h3d4a86898599a5a5
3:     0x7ffe15232900 - <unknown>
4:     0x7ffe1524d4de - rustc_errors::Handler::bug::h2f937f942ddca725
5:     0x7ffdfbd77385 - rustc::session::bug_fmt::h2aeb8933d35adaa0
6:     0x7ffdfbd771ba - rustc::session::bug_fmt::h2aeb8933d35adaa0
7:     0x7ffdfbd7692c - rustc::session::bug_fmt::h2aeb8933d35adaa0
8:     0x7ffdfbc697fc - rustc::hir::map::Map::read::h566f10c83992cae3
9:     0x7ffdfbc6a099 - rustc::hir::map::Map::body::h0c85c5740cc480e4
10:     0x7ffe11f9fa3c - rustc_const_eval::eval::eval_const_expr_partial::h4e21687640f52ea0
11:     0x7ffe11fa29b2 - rustc_const_eval::eval::eval_const_expr_partial::h4e21687640f52ea0
12:     0x7ffe15c0eae4 - <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr::h073f7942a7c53bc0
13:     0x7ffe15c0e61e - <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr::h073f7942a7c53bc0
14:     0x7ffe15c0e41e - <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr::h073f7942a7c53bc0
15:     0x7ffe15c0be06 - <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_nested_body::h6c88f222db58dfdf
16:     0x7ffe15c0e74d - <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr::h073f7942a7c53bc0
17:     0x7ffe15c0e6ae - <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr::h073f7942a7c53bc0
18:     0x7ffe15c0e41e - <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr::h073f7942a7c53bc0
19:     0x7ffe15c0e7de - <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr::h073f7942a7c53bc0
@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jan 3, 2017
@alexcrichton
Copy link
Member

Confirmed with PistonDevelopers/piston-examples@037b2aa with a successful beta:

rustc 1.15.0-beta.2 (519656798 2016-12-30)
binary: rustc
commit-hash: 519656798df590590796a25b7db700afd4846bb5
commit-date: 2016-12-30
host: x86_64-unknown-linux-gnu
release: 1.15.0-beta.2
LLVM version: 3.9

and a failing nightly:

rustc 1.16.0-nightly (468227129 2017-01-03)
binary: rustc
commit-hash: 468227129d08b52c4cf90313b29fdad1b80e596b
commit-date: 2017-01-03
host: x86_64-unknown-linux-gnu
release: 1.16.0-nightly
LLVM version: 3.9

@alexcrichton alexcrichton added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 4, 2017
@alexcrichton
Copy link
Member

cc @rust-lang/compiler, seems to be a regression

@eddyb
Copy link
Member

eddyb commented Jan 5, 2017

This might've been me. If someone wants to, they could try #38813 which completely removes inlined bodies from the HIR map (I'm on a different branch otherwise I would've tried it).

@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added the P-high High priority label Jan 5, 2017
@nikomatsakis nikomatsakis self-assigned this Jan 5, 2017
@nikomatsakis
Copy link
Contributor

I can verify that my local build w/ @eddyb's PR is able to build PistonExamples

bors added a commit that referenced this issue Jan 8, 2017
[11/n] Separate ty::Tables into one per each body.

_This is part of a series ([prev](#38449) | [next]()) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments._

<hr>

In order to track the results of type-checking and inference for incremental recompilation, they must be stored separately for each function or constant value, instead of lumped together.

These side-`Tables` also have to be tracked by various passes, as they visit through bodies (all of which have `Tables`, even if closures share the ones from their parent functions). This is usually done by switching a `tables` field in an override of `visit_nested_body` before recursing through `visit_body`, to the relevant one and then restoring it - however, in many cases the nesting is unnecessary and creating the visitor for each body in the crate and then visiting that body, would be a much cleaner solution.

To simplify handling of inlined HIR & its side-tables, their `NodeId` remapping and entries HIR map were fully stripped out, which means that `NodeId`s from inlined HIR must not be used where a local `NodeId` is expected. It might be possible to make the nodes (`Expr`, `Block`, `Pat`, etc.) that only show up within a `Body` have IDs that are scoped to that `Body`, which would also allow `Tables` to use `Vec`s.

That last part also fixes #38790 which was accidentally introduced in a previous refactor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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.

7 participants
@steveklabnik @alexcrichton @eddyb @nikomatsakis @martinlindhe @rust-highfive and others