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 in stable 1.9 - ERROR:rbml::reader: failed to find block with tag 32 | [Avoided by removing type decl from closure scope?] #34027

Closed
mitchmindtree opened this issue Jun 2, 2016 · 14 comments
Assignees
Labels
A-metadata Area: Crate metadata I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mitchmindtree
Copy link
Contributor

mitchmindtree commented Jun 2, 2016

Version: rustc 1.9.0 (e4e8b6668 2016-05-18). Edit: According to travis this also occurs on the current nightly.

Specifically, the ICE occurs while compiling this conrod example in this commit.

Curiously, the ICE goes away when I remove the call to .set on the TextBox widget here. I've not yet been able to reduce this case, but will post again if I do.

This same code compiles without issues on 1.8 - the ICE only appeared after updating to 1.9.

Here is the backtrace:

Compiling conrod v0.35.0 (file:///Users/Mitch/Programming/Rust/conrod)
ERROR:rbml::reader: failed to find block with tag 32
error: internal compiler error: unexpected panic
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 'explicit panic', ../src/librbml/lib.rs:436
stack backtrace:
   1:        0x1138723a8 - std::sys::backtrace::tracing::imp::write::h4c73fcd3363076f5
   2:        0x11387e7f5 - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h0422dbb3077e6747
   3:        0x11387e32f - std::panicking::default_hook::haac48fa641db8fa2
   4:        0x113842f86 - std::sys_common::unwind::begin_unwind_inner::h39d40f52add53ef7
   5:        0x1136949a4 - std::sys_common::unwind::begin_unwind::hd78480d5ec5c51b2
   6:        0x113692474 - rbml::reader::get_doc::hdb38d8b870a9741e
   7:        0x10f99299d - rustc_metadata::decoder::item_name::h3555f424e252b80a
   8:        0x10f9de58f - rustc_metadata::csearch::_<impl rustc..middle..cstore..CrateStore<'tcx> for cstore..CStore>::item_name::h5a2f704e44fa63dd
   9:        0x11248552b - rustc::ty::item_path::_<impl ty..context..TyCtxt<'tcx>>::push_item_path::h2f534fe42b7ac460
  10:        0x112485c67 - rustc::ty::item_path::_<impl ty..context..TyCtxt<'tcx>>::push_item_path::h2f534fe42b7ac460
  11:        0x1122408d6 - rustc::ty::item_path::_<impl ty..context..TyCtxt<'tcx>>::item_path_str::hdfe5253566d88e9d
  12:        0x10fe3febd - rustc_trans::type_of::llvm_type_name::hc7d62319533c1664
  13:        0x10fd199ea - rustc_trans::type_of::in_memory_type_of::h3452b62d9f897a08
  14:        0x10fd1db53 - rustc_trans::base::alloc_ty_init::h8fcff585abc6d109
  15:        0x10fe18bad - rustc_trans::_match::mk_binding_alloca::hb33a12c04b932154
  16:        0x10fd315c8 - rustc_trans::base::init_local::hc7657c54dfb70dae
  17:        0x10fd47f3a - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  18:        0x10fdd9bf0 - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  19:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  20:        0x10fd4821e - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  21:        0x10fd46780 - rustc_trans::base::trans_closure::h3bda42021fe9c927
  22:        0x10fd99287 - rustc_trans::closure::trans_closure_expr::ha3ce342c7e1142af
  23:        0x10fddb1ca - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  24:        0x10fdd7f83 - rustc_trans::expr::trans_unadjusted::h0d70d7046e42f3dd
  25:        0x10fd90708 - rustc_trans::expr::trans::h70c640c22e74aeac
  26:        0x10fd8f38e - rustc_trans::callee::trans_args::h612d1760ca9c25c5
  27:        0x10fd24a0d - rustc_trans::callee::Callee::call::h96992640d29984f5
  28:        0x10fdd9b3f - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  29:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  30:        0x10fd4821e - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  31:        0x10fdd9bf0 - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  32:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  33:        0x10fd4821e - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  34:        0x10fd46780 - rustc_trans::base::trans_closure::h3bda42021fe9c927
  35:        0x10fd99287 - rustc_trans::closure::trans_closure_expr::ha3ce342c7e1142af
  36:        0x10fddb1ca - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  37:        0x10fdd7f83 - rustc_trans::expr::trans_unadjusted::h0d70d7046e42f3dd
  38:        0x10fd90708 - rustc_trans::expr::trans::h70c640c22e74aeac
  39:        0x10fd8f38e - rustc_trans::callee::trans_args::h612d1760ca9c25c5
  40:        0x10fd24a0d - rustc_trans::callee::Callee::call::h96992640d29984f5
  41:        0x10fdd9b3f - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  42:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  43:        0x10fd4821e - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  44:        0x10fd46780 - rustc_trans::base::trans_closure::h3bda42021fe9c927
  45:        0x10fd99287 - rustc_trans::closure::trans_closure_expr::ha3ce342c7e1142af
  46:        0x10fddb1ca - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  47:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  48:        0x10fe18c54 - rustc_trans::_match::mk_binding_alloca::hb33a12c04b932154
  49:        0x10fd315c8 - rustc_trans::base::init_local::hc7657c54dfb70dae
  50:        0x10fd47f3a - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  51:        0x10fd46780 - rustc_trans::base::trans_closure::h3bda42021fe9c927
  52:        0x10fd48911 - rustc_trans::base::trans_fn::he1c838fa1dbfdc03
  53:        0x10fd7b52e - rustc_trans::callee::get_fn::haaf760d478d95498
  54:        0x10fd261b1 - rustc_trans::callee::Callee::def::he88e0427a7068fef
  55:        0x10fd76ad0 - rustc_trans::callee::Callee::method_call::h48772eaa2f745a02
  56:        0x10fdd9aa7 - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  57:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  58:        0x10fdb5f62 - rustc_trans::controlflow::trans_stmt_semi::hcba83f2a6075f097
  59:        0x10fd47f16 - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  60:        0x10fdd9bf0 - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  61:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  62:        0x10fe18c54 - rustc_trans::_match::mk_binding_alloca::hb33a12c04b932154
  63:        0x10fd315c8 - rustc_trans::base::init_local::hc7657c54dfb70dae
  64:        0x10fd47f3a - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  65:        0x10fdd9bf0 - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  66:        0x10fdd7f83 - rustc_trans::expr::trans_unadjusted::h0d70d7046e42f3dd
  67:        0x10fd90708 - rustc_trans::expr::trans::h70c640c22e74aeac
  68:        0x10fd31687 - rustc_trans::base::init_local::hc7657c54dfb70dae
  69:        0x10fd47f3a - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  70:        0x10fd46780 - rustc_trans::base::trans_closure::h3bda42021fe9c927
  71:        0x10fd48911 - rustc_trans::base::trans_fn::he1c838fa1dbfdc03
  72:        0x10fd7b52e - rustc_trans::callee::get_fn::haaf760d478d95498
  73:        0x10fd25b27 - rustc_trans::callee::Callee::def::he88e0427a7068fef
  74:        0x10fddb474 - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  75:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  76:        0x10fdb5f62 - rustc_trans::controlflow::trans_stmt_semi::hcba83f2a6075f097
  77:        0x10fd47f16 - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  78:        0x10fd46780 - rustc_trans::base::trans_closure::h3bda42021fe9c927
  79:        0x10fd48911 - rustc_trans::base::trans_fn::he1c838fa1dbfdc03
  80:        0x10fd7b52e - rustc_trans::callee::get_fn::haaf760d478d95498
  81:        0x10fd261b1 - rustc_trans::callee::Callee::def::he88e0427a7068fef
  82:        0x10fd76ad0 - rustc_trans::callee::Callee::method_call::h48772eaa2f745a02
  83:        0x10fdd9aa7 - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  84:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  85:        0x10fdb5f62 - rustc_trans::controlflow::trans_stmt_semi::hcba83f2a6075f097
  86:        0x10fd47f16 - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  87:        0x10fd46780 - rustc_trans::base::trans_closure::h3bda42021fe9c927
  88:        0x10fd48911 - rustc_trans::base::trans_fn::he1c838fa1dbfdc03
  89:        0x10fd7b52e - rustc_trans::callee::get_fn::haaf760d478d95498
  90:        0x10fd261b1 - rustc_trans::callee::Callee::def::he88e0427a7068fef
  91:        0x10fd76ad0 - rustc_trans::callee::Callee::method_call::h48772eaa2f745a02
  92:        0x10fdd9aa7 - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  93:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  94:        0x10fdb5f62 - rustc_trans::controlflow::trans_stmt_semi::hcba83f2a6075f097
  95:        0x10fd47f16 - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
  96:        0x10fdd9bf0 - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
  97:        0x10fd50b35 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
  98:        0x10fe18c54 - rustc_trans::_match::mk_binding_alloca::hb33a12c04b932154
  99:        0x10fd315c8 - rustc_trans::base::init_local::hc7657c54dfb70dae
  100:        0x10fd47f3a - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
 ... <frames omitted>

This could be related to #32696.

@nagisa
Copy link
Member

nagisa commented Jun 2, 2016

I’m pretty sure this is the same thing as #33778, hmm, maybe not.

@nagisa nagisa added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-metadata Area: Crate metadata labels Jun 2, 2016
@mitchmindtree
Copy link
Contributor Author

mitchmindtree commented Jun 6, 2016

After further testing, it appears the ICE occurs whenever the Widget trait's set method is called on either the TextEdit or TextBox widgets (doesn't seem to be an issue for any other widgets).

Still unsure of how to work around this atm, but will keep hunting.

@mitchmindtree
Copy link
Contributor Author

I've added a commit with a much smaller example that demonstrates the same ICE.

Removing this line and adding a semi colon to the end of the one above it stops the ICE from occurring, though I'm unsure why. That method definition can be found here.

@mitchmindtree
Copy link
Contributor Author

Interestingly, removing the body of the Widget::set method also stops the ICE from occurring.

@mitchmindtree
Copy link
Contributor Author

mitchmindtree commented Jun 6, 2016

This might be related to #33364 as in both issues the ICE seems to have appeared in 1.9 and still remains in the current nightly.

The example in #33364 also demonstrates that the ICE occurs when doing a blanket impl of some trait for a generic tuple whose elements' types are used as associated types. Conrod uses this same pattern for its Backend trait. Also, the Widget::set method that was mentioned before does take a generic Backend type, so it does seem related in this sense. This still doesn't explain why the ICE is only triggered when called upon the TextBox or TextEdit widgets.

Edit: The issue doesn't seem to be related to the blanket impl of Backend for the generic tuple as the ICE still occurs if I implement Backend for a unique struct too.

@mitchmindtree mitchmindtree changed the title ICE in stable 1.9 - ERROR:rbml::reader: failed to find block with tag 32 ICE in stable 1.9 - ERROR:rbml::reader: failed to find block with tag 32 | [SOLVED by removing type decl from closure scope?] Jun 7, 2016
@mitchmindtree
Copy link
Contributor Author

OK, I've managed to work around the ICE in Conrod!

It turns out it was being caused by declaring a struct within the scope of a closure. After removing the struct declaration and using local variables instead of fields, the ICE went away. This was within the body of a TextEdit method, so it makes sense why TextBox would also error as it uses a TextEdit instance internally. This is the commit that fixed the ICE.

Note that the ICE wouldn't occur when compiling conrod itself, but would occur when using conrod as a dependency and attempting to use a part of conrod's API that used the code with the closure-scoped struct declaration internally.

@mitchmindtree mitchmindtree changed the title ICE in stable 1.9 - ERROR:rbml::reader: failed to find block with tag 32 | [SOLVED by removing type decl from closure scope?] ICE in stable 1.9 - ERROR:rbml::reader: failed to find block with tag 32 | [Avoided by removing type decl from closure scope?] Jun 7, 2016
@mitchmindtree
Copy link
Contributor Author

I've managed to hit this very same ICE again in totally unrelated code in a different crate. Will post again when I get some more details.

@bluss bluss added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Jun 8, 2016
@filmor
Copy link

filmor commented Jun 10, 2016

This bug occurs also in synth in both 1.9 and beta for me, nightly works for this crate. Seems to have something to do with @mitchmindtree's authorship ;)

Same issue as #33733 and #33015.

@mitchmindtree
Copy link
Contributor Author

As @filmor mentioned, the synth crate continues to ICE on both stable and beta, though nightly seems to be working. I'd request porting the fix to beta, though I'm unaware which commit to nightly has fixed the issue. Hopefully I'll get a chance to hunt it down before the end of this release cycle.

@arielb1
Copy link
Contributor

arielb1 commented Jun 20, 2016

Not the same issue as #33733/#33015.

I think I fixed this by accident when I tried to get RUST_LOG working, but that was in the middle of a big PR. I can backport the individual change.

@brson brson added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 23, 2016
@brson
Copy link
Contributor

brson commented Jun 23, 2016

@rust-lang/compiler Seems bad, but has a fix. @arielb1 will you go ahead and try to backport a patch?

@pnkfelix
Copy link
Member

@arielb1 says he can backport to beta, and will also try to target stable as well

@pnkfelix
Copy link
Member

pnkfelix commented Jul 7, 2016

fixed by #34561

correction: not fixed by that PR; we decided to not backport that PR to beta. (See discussion on that ticket.)

@mitchmindtree
Copy link
Contributor Author

mitchmindtree commented Aug 2, 2016

I managed to avoid the ICE that would occur when compiling the synth crate (mentioned by @filmor) with this PR to one of its dependencies.

Similarly to the conrod fix, all the PR does is move an item definition (this time a function rather than a struct) out of the body of a function and to the root of the module.

Now however, I've managed to hit this same ICE again in a separate, personal, closed source project. Following the pattern in the conrod and synth crate fixes, I suspect this will involve hunting down some definition defined within the scope of a function or method (perhaps in this crate, or perhaps in the dependency of a dependency of a dependency...) and moving it to the root of the module. Edit: Confirmed, this was the case.

@pnkfelix if this is not yet fixed by the PR you linked, would you mind re-opening this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-metadata Area: Crate metadata I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants