Skip to content

thread 'rustc' panicked at 'forcing query with already existing DepNode #88929

Closed
@FredrikNoren

Description

@FredrikNoren

Hi,

I wasn't getting this error a few weeks ago on the same source code, so seems like something changed in the nightly build. Also; if I comment out lines 74-76 in the code in the gist, I can get it to build, and if I then (once it has built once) uncomment those lines again it also works to build (even though the code is now identical to the code that caused the crash initially).

Code

https://gist.github.com/FredrikNoren/b6192571618273ebc8141f728813f63b

Meta

rustc 1.57.0-nightly (51e514c0f 2021-09-12)
binary: rustc
commit-hash: 51e514c0fb4f9afcaae3b02dd9ccb93e15b30ef8
commit-date: 2021-09-12
host: aarch64-apple-darwin
release: 1.57.0-nightly
LLVM version: 13.0.0

Error output

thread 'rustc' panicked at 'forcing query with already existing `DepNode`
- query-key: Binder(std::ops::FnOnce<({integer},)>, [])
- dep-node: own_existential_vtable_entries(1b1693b94cac66ac-e9d0bd598b7b436b)', /rustc/51e514c0fb4f9afcaae3b02dd9ccb93e15b30ef8/compiler/rustc_query_system/src/dep_graph/graph.rs:247:9
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.57.0-nightly (51e514c0f 2021-09-12) running on aarch64-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 [own_existential_vtable_entries] finding all existential vtable entries for trait std::ops::FnOnce
#1 [evaluate_obligation] evaluating trait selection obligation `for<'r> (dyn std::ops::Fn(^2_0) + std::marker::Send + std::marker::Sync + 'r): std::ops::Fn<(^1_2,)>`
end of query stack
Backtrace

thread 'rustc' panicked at 'forcing query with already existing `DepNode`
- query-key: Binder(std::ops::FnOnce<({integer},)>, [])
- dep-node: own_existential_vtable_entries(1b1693b94cac66ac-e9d0bd598b7b436b)', /rustc/51e514c0fb4f9afcaae3b02dd9ccb93e15b30ef8/compiler/rustc_query_system/src/dep_graph/graph.rs:247:9
stack backtrace:
   0: _rust_begin_unwind
   1: std::panicking::begin_panic_fmt
   2: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
   3: rustc_data_structures::stack::ensure_sufficient_stack
   4: rustc_query_system::query::plumbing::get_query
   5: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::own_existential_vtable_entries
   6: rustc_trait_selection::traits::util::count_own_vtable_entries
   7: rustc_trait_selection::traits::vtable_trait_first_method_offset
   8: rustc_trait_selection::traits::select::confirmation::<impl rustc_trait_selection::traits::select::SelectionContext>::confirm_candidate
   9: rustc_infer::infer::InferCtxt::probe
  10: rustc_trait_selection::traits::select::SelectionContext::evaluate_candidate
  11: rustc_trait_selection::traits::select::SelectionContext::evaluate_stack
  12: rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task
  13: rustc_trait_selection::traits::select::SelectionContext::evaluate_trait_predicate_recursively
  14: rustc_data_structures::stack::ensure_sufficient_stack
  15: rustc_trait_selection::traits::select::SelectionContext::evaluate_predicate_recursively
  16: rustc_infer::infer::InferCtxt::probe
  17: rustc_trait_selection::traits::select::SelectionContext::evaluate_root_obligation
  18: rustc_infer::infer::InferCtxtBuilder::enter_with_canonical
  19: rustc_traits::evaluate_obligation::evaluate_obligation
  20: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  21: rustc_data_structures::stack::ensure_sufficient_stack
  22: rustc_query_system::query::plumbing::get_query
  23: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::evaluate_obligation
  24: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  25: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  26: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_may_hold
  27: rustc_typeck::check::method::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::lookup_method_in_trait
  28: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::try_overloaded_call_traits
  29: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  30: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  31: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
  32: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  33: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  34: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  35: rustc_typeck::check::check::check_fn
  36: rustc_typeck::check::closure::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_closure
  37: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  38: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  39: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  40: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  41: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  42: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  43: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  44: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_method_argument_types
  45: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  46: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  47: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  48: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  49: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  50: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  51: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  52: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  53: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  54: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  55: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_coercable_to_type
  56: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  57: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  58: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  59: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  60: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_coercable_to_type
  61: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  62: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  63: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  64: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  65: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  66: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  67: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  68: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  69: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  70: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  71: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  72: rustc_typeck::check::check::check_fn
  73: rustc_infer::infer::InferCtxtBuilder::enter
  74: rustc_typeck::check::typeck
  75: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  76: rustc_data_structures::stack::ensure_sufficient_stack
  77: rustc_query_system::query::plumbing::try_execute_query
  78: rustc_query_system::query::plumbing::get_query
  79: rustc_typeck::check::typeck
  80: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  81: rustc_data_structures::stack::ensure_sufficient_stack
  82: rustc_query_system::query::plumbing::try_execute_query
  83: rustc_query_system::query::plumbing::get_query
  84: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  85: rustc_typeck::check::typeck_item_bodies
  86: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  87: rustc_data_structures::stack::ensure_sufficient_stack
  88: rustc_query_system::query::plumbing::try_execute_query
  89: rustc_query_system::query::plumbing::get_query
  90: rustc_session::utils::<impl rustc_session::session::Session>::time
  91: rustc_typeck::check_crate
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.57.0-nightly (51e514c0f 2021-09-12) running on aarch64-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 [own_existential_vtable_entries] finding all existential vtable entries for trait std::ops::FnOnce
#1 [evaluate_obligation] evaluating trait selection obligation `for<'r> (dyn std::ops::Fn(^2_0) + std::marker::Send + std::marker::Sync + 'r): std::ops::Fn<(^1_2,)>`
#2 [typeck] type-checking `<impl at elements/examples/ui.rs:52:1: 93:2>::render`
#3 [typeck] type-checking `<impl at elements/examples/ui.rs:52:1: 93:2>::render::{closure#0}`
#4 [typeck_item_bodies] type-checking all item bodies
#5 [analysis] running analysis passes on this crate
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions