Skip to content

ICE: panicked at 'RefCell<T> already borrowed', /Users/carllerche/Code/oss/rust/src/libcore/cell.rs:317 #18711

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

Closed
carllerche opened this issue Nov 6, 2014 · 4 comments · Fixed by #18729

Comments

@carllerche
Copy link
Member

rustc version: rustc 0.13.0-dev (60a669a 2014-11-06 14:06:59 +0000)

Repro:

I have not yet been able to isolate to a small case, but clone the following repo on the "ice-repo2" branch (sorry, typos) and run cargo test, it should ICE

https://github.com/carllerche/astaire/tree/ice-repo2

Backtrace

error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'RefCell<T> already borrowed', /Users/carllerche/Code/oss/rust/src/libcore/cell.rs:317

stack backtrace:
   1:        0x10a9f8b3f - rt::backtrace::imp::write::h2ff90a76b93803d4wdq
   2:        0x10a9fbcc7 - failure::on_fail::hb9446c51627aa852luq
   3:        0x10ac54855 - unwind::begin_unwind_inner::hb06e7f4e8a4318c3NJd
   4:        0x10ac54518 - unwind::begin_unwind_fmt::h06689276fe1886c0fHd
   5:        0x10ac54272 - rust_begin_unwind
   6:        0x10aca40bc - panicking::panic_fmt::hfaf6da97a3eeb8f2y7j
   7:        0x10ac9ab0f - panicking::panic::h02d6408bd2255aa5C4j
   8:        0x10782684b - middle::astencode::decode_side_tables::closure.114678
   9:        0x10a00e7b6 - reader::docs::h468ef2f5473ec55euTa
  10:        0x1076cac6d - middle::astencode::decode_inlined_item::hd744c6fdd78d459asCd
  11:        0x1078e3084 - middle::const_eval::lookup_variant_by_id::closure.118471
  12:        0x107fcecf3 - middle::trans::inline::instantiate_inline::closure.123290
  13:        0x107eba57b - metadata::decoder::maybe_get_item_ast::h9e4d672ed43e14e2bvx
  14:        0x1079ed00f - middle::trans::inline::instantiate_inline::h6de6d9c3889784346M0
  15:        0x107a25943 - middle::trans::callee::trans_fn_ref_with_substs::hdb01074bff7fc08f1c4
  16:        0x107a234e8 - middle::trans::callee::trans_fn_ref::h1a91258cddd65598R03
  17:        0x107a0887d - middle::trans::meth::trans_method_callee::hc75c8689a4447f7au8m
  18:        0x107a2b8cb - middle::trans::callee::trans_method_call::closure.124024
  19:        0x107a06be5 - middle::trans::callee::trans_call_inner::h9815d9afb9e1ec44Ly4
  20:        0x107a2b6fd - middle::trans::callee::trans_method_call::he027fede3ae25373du4
  21:        0x107a390fd - middle::trans::expr::trans_rvalue_dps_unadjusted::h7dbd4d63b7e1f10aEH6
  22:        0x107a37e61 - middle::trans::expr::trans_unadjusted::ha98f989fff991c48B35
  23:        0x107a009dd - middle::trans::expr::trans::he231f09d11f1a48dxm5
  24:        0x1079fe77d - middle::trans::controlflow::trans_stmt_semi::h020e65f758f11838ry1
  25:        0x1079fde80 - middle::trans::controlflow::trans_stmt::hc03c7e6720b2276beu1
  26:        0x1079ff6b8 - middle::trans::controlflow::trans_block::h3b3f26872c4554fbkz1
  27:        0x107a39624 - middle::trans::expr::trans_rvalue_dps_unadjusted::h7dbd4d63b7e1f10aEH6
  28:        0x1079ff469 - middle::trans::expr::trans_into::h00984fb0dd3ef008Di5
  29:        0x1079ff7be - middle::trans::controlflow::trans_block::h3b3f26872c4554fbkz1
  30:        0x107a9f948 - middle::trans::base::trans_closure::h638c8183c6a8c3b1XIh
  31:        0x107a4da90 - middle::trans::closure::trans_unboxed_closure::hb43598d7c59a231bD4l
  32:        0x107a395f2 - middle::trans::expr::trans_rvalue_dps_unadjusted::h7dbd4d63b7e1f10aEH6
  33:        0x107a37e61 - middle::trans::expr::trans_unadjusted::ha98f989fff991c48B35
  34:        0x107a009dd - middle::trans::expr::trans::he231f09d11f1a48dxm5
  35:        0x107a315d0 - middle::trans::callee::trans_args::h26b99096d88adfffWT4
  36:        0x107a07cd0 - middle::trans::callee::trans_call_inner::h9815d9afb9e1ec44Ly4
  37:        0x107a2b6fd - middle::trans::callee::trans_method_call::he027fede3ae25373du4
  38:        0x107a390fd - middle::trans::expr::trans_rvalue_dps_unadjusted::h7dbd4d63b7e1f10aEH6
  39:        0x1079ff469 - middle::trans::expr::trans_into::h00984fb0dd3ef008Di5
  40:        0x107ac717e - middle::trans::_match::store_local::closure.127810
  41:        0x107ac7030 - middle::trans::_match::mk_binding_alloca::h2042705593528179270
  42:        0x107a9735f - middle::trans::_match::store_local::ha914c957ec74fc25cdl
  43:        0x1079fea44 - middle::trans::base::init_local::h9ae72d5affea250csOg
  44:        0x1079fdeb1 - middle::trans::controlflow::trans_stmt::hc03c7e6720b2276beu1
  45:        0x1079ff6b8 - middle::trans::controlflow::trans_block::h3b3f26872c4554fbkz1
  46:        0x107a9f948 - middle::trans::base::trans_closure::h638c8183c6a8c3b1XIh
  47:        0x1079f2f9c - middle::trans::base::trans_fn::ha597ae815301c37bSUh
  48:        0x1079f06a1 - middle::trans::base::trans_item::h7ef8b7e6130a9cb16di
  49:        0x1079f0bd8 - middle::trans::base::trans_item::h7ef8b7e6130a9cb16di
  50:        0x107aa89f9 - middle::trans::base::trans_crate::hdeb74411a2b08c317bj
  51:        0x107ef3445 - driver::driver::phase_4_translate_to_llvm::h75d3ab0b8caab322KwC
  52:        0x107eebcc1 - driver::driver::compile_input::h6d8884a3959ef920E3B
  53:        0x107f6a3ad - driver::run_compiler::h31af41afacc0fe35VTF
  54:        0x107f6883e - driver::run::closure.147439
  55:        0x1076b96ab - task::TaskBuilder<S>::try_future::closure.104811
  56:        0x1076b95a3 - task::TaskBuilder<S>::spawn_internal::closure.104782
  57:        0x10a089d7d - task::NativeSpawner.Spawner::spawn::closure.8538
  58:        0x10acb39cc - rust_try_inner
  59:        0x10acb39b6 - rust_try
  60:        0x10ac52057 - unwind::try::ha62186b67ab65c30vyd
  61:        0x10ac51eec - task::Task::run::hdb6100930f630459iKc
  62:        0x10a089ba3 - task::NativeSpawner.Spawner::spawn::closure.8475
  63:        0x10ac53717 - thread::thread_start::h7c5f82d4ec72fc8cx5c
  64:     0x7fff8e631772 - _pthread_start
@nikomatsakis
Copy link
Contributor

cc me -- note this a refcell failure. first step is probably to figure out which hashmap is being written into, then figure out who is iterating over it etc

@carllerche
Copy link
Member Author

I enabled debug logs, this is what I got when filtering to middle::astencode

DEBUG:rustc::middle::astencode: >< Side table doc loaded
DEBUG:rustc::middle::astencode: >> Side table document with tag 0x49 found for id 15510 (orig 2435)
DEBUG:rustc::middle::astencode: >< Side table doc loaded
DEBUG:rustc::middle::astencode: >> Side table document with tag 0x56 found for id 15510 (orig 2435)
DEBUG:rustc::middle::astencode: >< Side table doc loaded
DEBUG:rustc::middle::astencode: >> Side table document with tag 0x54 found for id 15510 (orig 2435)
DEBUG:rustc::middle::astencode: convert_def_id(source=NominalType, did=DefId { krate: 0, node: 2337 })=DefId { krate: 13, node: 2337 }
DEBUG:rustc::middle::astencode: convert_def_id(source=TypeParameter, did=DefId { krate: 0, node: 2451 })=DefId { krate: 0, node: 15526 }
error: internal compiler error: unexpected panic

@carllerche
Copy link
Member Author

@bkoropoff
Copy link
Contributor

I think I see the conflicting borrow, it's really silly. Coming up with a reduced test case will probably be harder than fixing it.

bkoropoff added a commit to bkoropoff/rust that referenced this issue Nov 7, 2014
bkoropoff added a commit to bkoropoff/rust that referenced this issue Nov 7, 2014
bors added a commit that referenced this issue Nov 8, 2014
lnicola pushed a commit to lnicola/rust that referenced this issue Dec 23, 2024
Taking a raw ref of a deref is always safe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants