Skip to content

ICE: forcing query with already existing DepNode #10298

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
kayabaNerve opened this issue Feb 5, 2023 · 5 comments
Closed

ICE: forcing query with already existing DepNode #10298

kayabaNerve opened this issue Feb 5, 2023 · 5 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@kayabaNerve
Copy link

kayabaNerve commented Feb 5, 2023

Summary

https://github.com/serai-dex/serai/tree/97951e3f4fcef1be3ad1693228883fe9a2e3709b/processor is the crate which triggered this (and exact commit). While I do not have a MRE, I hope this either serves as an additional stack trace, or that the ~350 line file the backtrace specifies is sufficiently small/readable.

Even without a fix being made available, I'd greatly appreciate if the underlying problem was identified so I can workaround this.

Version

rustc 1.69.0-nightly (50d3ba5bc 2023-02-04)
binary: rustc
commit-hash: 50d3ba5bcbf5c7e13d4ce068d3339710701dd603
commit-date: 2023-02-04
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Error output

Backtrace

thread 'rustc' panicked at 'forcing query with already existing `DepNode`
- query-key: Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(TraitPredicate(<D as Db>, polarity:Positive), []), Binder(TraitPredicate(<D as std::clone::Clone>, polarity:Positive), []), Binder(TraitPredicate(<D as std::marker::Sync>, polarity:Positive), []), Binder(TraitPredicate(<D as std::marker::Send>, polarity:Positive), []), Binder(TraitPredicate(<C as coin::Coin>, polarity:Positive), []), Binder(TraitPredicate(<C as std::fmt::Debug>, polarity:Positive), []), Binder(TraitPredicate(<C as std::cmp::Eq>, polarity:Positive), []), Binder(TraitPredicate(<C as std::cmp::PartialEq>, polarity:Positive), []), Binder(TraitPredicate(<C as std::clone::Clone>, polarity:Positive), []), Binder(TraitPredicate(<C as std::marker::Sync>, polarity:Positive), []), Binder(TraitPredicate(<C as std::marker::Send>, polarity:Positive), []), Binder(TraitPredicate(<D as std::marker::Sized>, polarity:Positive), []), Binder(TraitPredicate(<C as std::marker::Sized>, polarity:Positive), []), Binder(OutlivesPredicate(D, ReStatic), []), Binder(OutlivesPredicate(C, ReStatic), [])], reveal: UserFacing, constness: NotConst }, value: Normalize { value: [async fn body@processor/src/signer.rs:152:26: 348:4] } } }
- dep-node: type_op_normalize_ty(86d75000ed1273ab-8c7ffe51fbbef097)', /rustc/50d3ba5bcbf5c7e13d4ce068d3339710701dd603/compiler/rustc_query_system/src/dep_graph/graph.rs:316:9
stack backtrace:
 0: rust_begin_unwind
           at /rustc/50d3ba5bcbf5c7e13d4ce068d3339710701dd603/library/std/src/panicking.rs:575:5
 1: core::panicking::panic_fmt
           at /rustc/50d3ba5bcbf5c7e13d4ce068d3339710701dd603/library/core/src/panicking.rs:64:14
 2: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_middle::infer::canonical::Canonical<rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::Normalize<rustc_middle::ty::Ty>>>, core::result::Result<&rustc_middle::infer::canonical::Canonical<rustc_middle::infer::canonical::QueryResponse<rustc_middle::ty::Ty>>, rustc_middle::traits::query::NoSolution>>
 3: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::type_op_normalize_ty, rustc_query_impl::plumbing::QueryCtxt>
 4: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::type_op_normalize_ty
 5: <rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::Normalize<rustc_middle::ty::Ty>> as rustc_trait_selection::traits::query::type_op::TypeOp>::fully_perform
 6: <&mut <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::create::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::Ty,)>>::call_once
 7: <alloc::vec::Vec<&rustc_middle::infer::canonical::QueryRegionConstraints> as alloc::vec::spec_from_iter::SpecFromIter<&rustc_middle::infer::canonical::QueryRegionConstraints, core::iter::adapters::flatten::FlatMap<core::iter::adapters::chain::Chain<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<rustc_middle::ty::Ty>>, core::option::IntoIter<rustc_middle::ty::Ty>>, core::iter::adapters::chain::Chain<core::iter::adapters::chain::Chain<core::option::IntoIter<&rustc_middle::infer::canonical::QueryRegionConstraints>, core::option::IntoIter<&rustc_middle::infer::canonical::QueryRegionConstraints>>, core::option::IntoIter<&rustc_middle::infer::canonical::QueryRegionConstraints>>, <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::create::{closure#0}>>>::from_iter
 8: rustc_borrowck::type_check::free_region_relations::create
 9: rustc_borrowck::type_check::type_check
10: rustc_borrowck::nll::compute_regions
11: rustc_borrowck::do_mir_borrowck
12: rustc_borrowck::mir_borrowck
13: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
14: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>
15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
17: <rustc_borrowck::type_check::TypeChecker>::prove_closure_bounds
18: <rustc_borrowck::type_check::TypeChecker>::typeck_mir
19: rustc_borrowck::type_check::type_check
20: rustc_borrowck::nll::compute_regions
21: rustc_borrowck::do_mir_borrowck
22: rustc_borrowck::mir_borrowck
23: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
24: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>
25: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
26: rustc_query_system::query::plumbing::force_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
27: rustc_query_impl::plumbing::force_from_dep_node::<rustc_query_impl::queries::mir_borrowck>
28: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
29: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
30: rustc_hir_analysis::check::check::check_mod_item_types
31: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, ()>
32: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
33: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
34: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
35: rustc_hir_analysis::check_crate
36: rustc_interface::passes::analysis
37: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
38: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
39: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
40: <rustc_interface::passes::QueryContext>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
41: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
42: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
43: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
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-clippy/issues/new

note: Clippy version: clippy 0.1.69 (50d3ba5 2023-02-04)

query stack during panic:
#0 [type_op_normalize_ty] normalizing `[async fn body@processor/src/signer.rs:152:26: 348:4]`
#1 [mir_borrowck] borrow-checking `signer::<impl at processor/src/signer.rs:100:1: 100:34>::run::{closure#0}`
#2 [mir_borrowck] borrow-checking `signer::<impl at processor/src/signer.rs:100:1: 100:34>::run`
#3 [type_of] computing type of `signer::<impl at processor/src/signer.rs:100:1: 100:34>::run::{opaque#0}`
#4 [check_mod_item_types] checking item types in module `signer`
#5 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `processor`

@kayabaNerve kayabaNerve added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Feb 5, 2023
@kayabaNerve
Copy link
Author

kayabaNerve commented Feb 5, 2023

It seems to be the lambda specified here: https://github.com/serai-dex/serai/blob/97951e3f4fcef1be3ad1693228883fe9a2e3709b/processor/src/signer.rs#L154-L159

Fully specifying it prevents this ICE from occurring.

I attempted to write a MRE premised on a similar pattern, yet was unable to get it to trigger.

@langston-barrett
Copy link

I'm not able to reproduce this. Here's what I tried:

git clone https://github.com/serai-dex/serai
cd serai/processor
rustup override set nightly
git checkout 97951e3f4fcef1be3ad1693228883fe9a2e3709b
cargo clippy
cargo clippy --release
clippy 0.1.70 (7b4f489 2023-03-12)

rustc 1.70.0-nightly (7b4f48927 2023-03-12)
binary: rustc
commit-hash: 7b4f48927dce585f747a58083b45ab62b9d73a53
commit-date: 2023-03-12
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

@kayabaNerve
Copy link
Author

It may no longer be an issue. I have not had this pop up over the past month (though that may just be since I patched the lambda to no longer trigger this).

The only note I'd make is I generally run --all-features --all-targets, in case that makes any difference with your reproduction attempts.

Thanks for spending the time. If it's not reproducible, I won't complain about closing this.

@kangalio
Copy link

kangalio commented May 2, 2023

I also ran into this

    Checking poise v0.5.3 (/home/kangalio/dev/rust/poise)
thread 'rustc' panicked at 'forcing query with already existing `DepNode`
- query-key: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(ProjectionPredicate(AliasTy { substs: [impl for<'b> FnOnce(&'b mut crate::CreateReply<'att>)
-> &'b mut crate::CreateReply<'att>, (&'b mut reply::builder::CreateReply<'_>,)], def_id: DefId(2:2940 ~ core[1d43]::ops::function::FnOnce::Output) }, Term::Ty(&'b mut reply::builder::CreateReply<'_>)), [Region(BrNamed(DefId(0:1909 ~ poise[298d]::structs::context::{impl#15}::send::'b), 'b))]), Binder(TraitPredicate(<impl for<'b> FnOnce(&'b mut crate::CreateReply<'att>)
-> &'b mut crate::CreateReply<'att> as std::ops::FnOnce<(&'b mut reply::builder::CreateReply<'_>,)>>, polarity:Positive), [Region(BrNamed(DefId(0:1909 ~ poise[298d]::structs::context::{impl#15}::send::'b), 'b))]), Binder(TraitPredicate(<impl for<'b> FnOnce(&'b mut crate::CreateReply<'att>)
-> &'b mut crate::CreateReply<'att> as std::marker::Sized>, polarity:Positive), []), Binder(TraitPredicate(<E as std::marker::Sized>, polarity:Positive), []), Binder(TraitPredicate(<U as std::marker::Sized>, polarity:Positive), [])], reveal: UserFacing, constness: NotConst }, value: Normalize { value: [async fn body@src/structs/context.rs:59:22: 61:14] } } }
- dep-node: type_op_normalize_ty(a3f5f0a56b8909be-e5edb6b394d64689)', /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/compiler/rustc_query_system/src/dep_graph/graph.rs:316: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-clippy/issues/new

note: Clippy version: clippy 0.1.68 (9eb3afe 2023-03-27)

query stack during panic:
#0 [type_op_normalize_ty] normalizing `[async fn body@src/structs/context.rs:59:22: 61:14]`
#1 [mir_borrowck] borrow-checking `structs::context::<impl at src/structs/context.rs:57:9: 57:54>::send::{closure#0}`
end of query stack
error: could not compile `poise`

I considered zipping my project including target folder, but it's almost 15 GB (Cargo caching has dementia) so I decided against. cargo clean -p PROJECTNAME fixes the problem as expected

@Jarcho
Copy link
Contributor

Jarcho commented Mar 9, 2025

Closing as this is a rustc incremental issue.

@Jarcho Jarcho closed this as completed Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants