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

Internal Compiler Error with RefCell #84336

Closed
DuncanConroy opened this issue Apr 19, 2021 · 3 comments
Closed

Internal Compiler Error with RefCell #84336

DuncanConroy opened this issue Apr 19, 2021 · 3 comments
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@DuncanConroy
Copy link

I was reading up on the Rust book and basically playing around with RefCell without knowing what I was doing :P

Code

use std::ops::Add;
use std::cell::RefCell;

#[derive(Debug)]
struct Bla{
    hello:String
}
static FOO:RefCell<Option<Bla>> = RefCell::new(None);
fn main() -> String {
    let mut output = String::new();
    output.add(&format!("FOO: {:#?}", FOO.into_inner().unwrap()));

    output
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (132b4e5d1 2021-04-13)
binary: rustc
commit-hash: 132b4e5d167b7e622fcc11fa2b67b931105b4de1
commit-date: 2021-04-13
host: x86_64-apple-darwin
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Some(Fingerprint(4565771098143344972, 7869445775526300234))`,
 right: `Some(Fingerprint(14934403843752251060, 623484215826468126))`: found unstable fingerprints for predicates_of(core[8495]::ops::arith::Add): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Rhs as std::marker::Sized>), []), /Users/daniel.bunte/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/arith.rs:75:15: 75:18 (#0)), (Binder(TraitPredicate(<Self as std::ops::Add<Rhs>>), []), /Users/daniel.bunte/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/arith.rs:75:1: 75:26 (#0))] }', /rustc/132b4e5d167b7e622fcc11fa2b67b931105b4de1/compiler/rustc_query_system/src/query/plumbing.rs:593:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (132b4e5d1 2021-04-13) running on x86_64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [predicates_of] computing predicates of `std::ops::Add`
#1 [typeck] type-checking `main`
end of query stack
error: could not compile `hellorust`
Backtrace

╭─daniel.bunte in ~/development/hellorust on master using 21-04-19 - 15:29:27
╰─🍓 cargo run
   Compiling hellorust v0.1.0 (/Users/daniel.bunte/development/hellorust)
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Some(Fingerprint(4565771098143344972, 7869445775526300234))`,
 right: `Some(Fingerprint(14934403843752251060, 623484215826468126))`: found unstable fingerprints for predicates_of(core[8495]::ops::arith::Add): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Rhs as std::marker::Sized>), []), /Users/daniel.bunte/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/arith.rs:75:15: 75:18 (#0)), (Binder(TraitPredicate(<Self as std::ops::Add<Rhs>>), []), /Users/daniel.bunte/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/arith.rs:75:1: 75:26 (#0))] }', /rustc/132b4e5d167b7e622fcc11fa2b67b931105b4de1/compiler/rustc_query_system/src/query/plumbing.rs:593:5
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
   4: rustc_query_system::query::plumbing::incremental_verify_ich
   5: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
   6: rustc_data_structures::stack::ensure_sufficient_stack
   7: rustc_query_system::query::plumbing::get_query_impl
   8: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::predicates_of
   9: rustc_middle::ty::generics::GenericPredicates::instantiate_into
  10: rustc_middle::ty::generics::GenericPredicates::instantiate
  11: rustc_typeck::check::method::confirm::ConfirmContext::confirm
  12: rustc_typeck::check::method::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::lookup_method
  13: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  14: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  15: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
  16: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  17: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  18: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  19: rustc_typeck::check::check::check_fn
  20: rustc_infer::infer::InferCtxtBuilder::enter
  21: rustc_typeck::check::typeck
  22: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  23: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  24: rustc_data_structures::stack::ensure_sufficient_stack
  25: rustc_query_system::query::plumbing::force_query_with_job
  26: rustc_query_system::query::plumbing::get_query_impl
  27: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  28: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  29: rustc_typeck::check::typeck_item_bodies
  30: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  31: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  32: rustc_data_structures::stack::ensure_sufficient_stack
  33: rustc_query_system::query::plumbing::force_query_with_job
  34: rustc_query_system::query::plumbing::get_query_impl
  35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  36: rustc_session::utils::<impl rustc_session::session::Session>::time
  37: rustc_typeck::check_crate
  38: rustc_interface::passes::analysis
  39: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  40: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  41: rustc_data_structures::stack::ensure_sufficient_stack
  42: rustc_query_system::query::plumbing::force_query_with_job
  43: rustc_query_system::query::plumbing::get_query_impl
  44: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  45: rustc_interface::passes::QueryContext::enter
  46: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  47: rustc_span::with_source_map
  48: rustc_interface::interface::create_compiler_and_run
  49: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (132b4e5d1 2021-04-13) running on x86_64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [predicates_of] computing predicates of `std::ops::Add`
#1 [typeck] type-checking `main`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `hellorust`

@DuncanConroy DuncanConroy added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 19, 2021
@wesleywiser wesleywiser added the A-incr-comp Area: Incremental compilation label Apr 19, 2021
@Aaron1011
Copy link
Member

@DuncanConroy: Do you remember what changes you were making before this happened? In particular, did you adjust or update your version of Rust using rustup?

@DuncanConroy
Copy link
Author

DuncanConroy commented Apr 19, 2021 via email

@wesleywiser
Copy link
Member

Thanks for filing the bug report! We are currently triaging issues related to #84970 to ensure each underlying problem gets resolved. Since this appears to be a duplicate of #83259, I'm going to close in favor of that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

3 participants