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

rustc internal compiler error: 'RefCell<T> already borrowed' #13763

Closed
carllerche opened this issue Apr 25, 2014 · 0 comments
Closed

rustc internal compiler error: 'RefCell<T> already borrowed' #13763

carllerche opened this issue Apr 25, 2014 · 0 comments

Comments

@carllerche
Copy link
Member

repro:

use std::u8;

static NUM: uint = u8::MAX as uint;

struct MyStruct {
  nums: [uint, ..256]
}

fn main() {
  let s = MyStruct { nums: [0, ..NUM] };
  println!("num {:?}", s);
}

backtrace:

error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'RefCell<T> already borrowed', /Users/carllerche/Code/oss/rust/src/libstd/cell.rs:158
stack backtrace:
   1:        0x10b3eee34 - rt::backtrace::imp::write::ha3f7ca69ee3354a5bCa::v0.11.pre
   2:        0x10b350f1e - rt::unwind::begin_unwind_inner::hc289551459a61c06hca::v0.11.pre
   3:        0x10873bb58 - rt::unwind::begin_unwind::h6565109718362079134::v0.11.pre
   4:        0x108d6bc87 - middle::astencode::decode_side_tables::closure.81006
   5:        0x10b095d30 - ebml::reader::docs::h665a98cd2ba14580wVe::v0.11.pre
   6:        0x10873e23d - middle::astencode::decode_inlined_item::h1a37eac7edc8c432RJR::v0.11.pre
   7:        0x108bf927b - middle::const_eval::lookup_const_by_id::closure.72988
   8:        0x108e7d2fc - metadata::decoder::maybe_get_item_ast::hb548b738bacfd640qeb::v0.11.pre
   9:        0x1088360a8 - middle::const_eval::lookup_const_by_id::h8899505373862d4dQ5Q::v0.11.pre
  10:        0x108861703 - middle::const_eval::lookup_const::h794169b85e5d439eI1Q::v0.11.pre
  11:        0x10885d895 - middle::const_eval::eval_const_expr_partial::h14321642868329550466::v0.11.pre
  12:        0x10885ddcf - middle::const_eval::eval_const_expr_partial::h14321642868329550466::v0.11.pre
  13:        0x108a0ef1b - middle::const_eval::eval_const_expr_partial::h13343781683720287911::v0.11.pre
  14:        0x108a0e829 - middle::ty::eval_repeat_count::h17378899464118624781::v0.11.pre
  15:        0x1089fa237 - middle::typeck::check::check_expr_with_unifier::h676f69ce3093b2d2cH9::v0.11.pre
  16:        0x108a0c52b - middle::typeck::check::check_expr_with_unifier::check_struct_or_variant_fields::h7be3b1077889f8bfkJa::v0.11.pre
  17:        0x1089ffb7f - middle::typeck::check::check_expr_with_unifier::h676f69ce3093b2d2cH9::v0.11.pre
  18:        0x108a13967 - middle::typeck::check::check_decl_local::h3d186907e0b8709fLWb::v0.11.pre
  19:        0x108a13c23 - middle::typeck::check::check_stmt::ha7692016058c4f1fIYb::v0.11.pre
  20:        0x1089d9555 - middle::typeck::check::check_block_with_expected::h562888ff8e3bd597F2b::v0.11.pre
  21:        0x1089d54e9 - middle::typeck::check::check_fn::h0bbaa66e10309365rw7::v0.11.pre
  22:        0x1089d4d1a - middle::typeck::check::check_bare_fn::h246b288fee103f44im7::v0.11.pre
  23:        0x1089ccd16 - middle::typeck::check::check_item::h48f276e2de542153FS7::v0.11.pre
  24:        0x1089d4aad - middle::typeck::check::check_item_types::h760ba130ac32d380Al7::v0.11.pre
  25:        0x108b0851f - util::common::time::h11105521565483743252::v0.11.pre
  26:        0x108b0744d - middle::typeck::check_crate::h792ad73b11a6a16aCQu::v0.11.pre
  27:        0x108f20a44 - driver::driver::phase_3_run_analysis_passes::h9009e318738b0d3a9tf::v0.11.pre
  28:        0x108f274eb - driver::driver::compile_input::hed4f3beb6c0afdbfMSf::v0.11.pre
  29:        0x108f4c850 - run_compiler::h1cf1e0f4a610f7f6bpn::v0.11.pre
  30:        0x108f606cd - main_args::closure.91482
  31:        0x108f5ea62 - monitor::closure.91357
  32:        0x108f5a5ab - task::TaskBuilder::try::closure.91123
  33:        0x10870549c - task::spawn_opts::closure.7113
  34:        0x10b3e9f38 - rt::task::Task::run::closure.40068
  35:        0x10b3f3cac - rust_try
  36:        0x10b3e9db7 - rt::task::Task::run::h5708e690b07fd669j37::v0.11.pre
  37:        0x10870531f - task::spawn_opts::closure.7085
  38:        0x10b3ed806 - rt::thread::thread_start::h02d275e99b3ee9de4H8::v0.11.pre
  39:     0x7fff8e14e772 - _pthread_start

version:

rustc 0.11-pre (bb580f1 2014-04-23 05:51:30 -0700)
host: x86_64-apple-darwin

bors added a commit that referenced this issue Apr 26, 2014
This addresses the ICE from #13763, but it does not allow the test to compile,
due to #13768. An alternate test was checked in in the meantime.

Closes #13763
arcnmx pushed a commit to arcnmx/rust that referenced this issue Jan 9, 2023
…Veykril

fix: add generic `TypeBoundList` in generated derivable impl

Potentially fixes rust-lang#13727.

Continuing with the work in rust-lang#13732, this fix tries to add correct type bounds in the generated `impl` block:

```diff
  enum Either<T, U> {
      Left(T),
      Right(U),
  }

- impl<T, U> PartialEq for Either<T, U> {
+ impl<T: PartialEq, U: PartialEq> PartialEq for Either<T, U> {
      fn eq(&self, other: &Self) -> bool {
          match (self, other) {
              (Self::Left(l0), Self::Left(r0)) => l0 == r0,
              (Self::Right(l0), Self::Right(r0)) => l0 == r0,
              _ => false,
          }
      }
  }
```
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.

1 participant