Skip to content

ICE with cargo clippy: thread '<unnamed>' panicked at 'forcing query with already existing 'DepNode' #9819

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
paolobarbolini opened this issue Nov 8, 2022 · 6 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@paolobarbolini
Copy link
Contributor

paolobarbolini commented Nov 8, 2022

Summary

This is happening on a closed source codebase. I might subsequently try minimizing if it helps.
cargo check and cargo build work correctly.

EDIT: code posted at: https://github.com/paolobarbolini/rust-clippy-issue-9819-repro

Version

rustc 1.67.0-nightly (73c9eaf21 2022-11-07)
binary: rustc
commit-hash: 73c9eaf21454b718e7c549984d9eb6e1f75e995c
commit-date: 2022-11-07
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

Error output

Backtrace

thread '<unnamed>' panicked at 'forcing query with already existing `DepNode`
- query-key: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, constness: NotConst }, value: Val(ByRef { alloc: Allocation { bytes: [0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], provenance: ProvenanceMap(SortedMap { data: [(Size(0 bytes), alloc1629), (Size(24 bytes), alloc1015)] }), init_mask: InitMask { blocks: [8589934591], len: Size(40 bytes) }, align: Align(8 bytes), mutability: Not, extra: () }, offset: Size(0 bytes) }, headers::HeaderValue) }
- dep-node: try_destructure_mir_constant(565f2fdf2a6560ed-e4a03ebe1c647288)', /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/compiler/rustc_query_system/src/dep_graph/graph.rs:316:9
stack backtrace:
 0: rust_begin_unwind
           at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/std/src/panicking.rs:575:5
 1: core::panicking::panic_fmt
           at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library/core/src/panicking.rs:65: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::ty::ParamEnvAnd<rustc_middle::mir::ConstantKind>, core::option::Option<rustc_middle::mir::query::DestructuredConstant>>
 3: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::ParamEnvAnd<rustc_middle::mir::ConstantKind>, core::option::Option<rustc_middle::mir::query::DestructuredConstant>>>
 4: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::try_destructure_mir_constant, rustc_query_impl::plumbing::QueryCtxt>
 5: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_destructure_mir_constant
 6: <rustc_middle::ty::context::TyCtxt>::destructure_mir_constant
 7: clippy_lints::non_copy_const::is_value_unfrozen_raw::inner
 8: <clippy_lints::non_copy_const::NonCopyConst as rustc_lint::passes::LateLintPass>::check_item
 9: <rustc_lint::early::EarlyLintPassObjects as rustc_lint::passes::EarlyLintPass>::check_local
10: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_item
11: rustc_hir::intravisit::walk_block::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
12: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_block
13: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_expr
14: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_body
15: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_fn
16: rustc_hir::intravisit::walk_expr::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
17: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_expr
18: rustc_hir::intravisit::walk_expr::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
19: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_expr
20: rustc_hir::intravisit::walk_expr::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
21: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_expr
22: rustc_hir::intravisit::walk_expr::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
23: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_expr
24: rustc_hir::intravisit::walk_block::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
25: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_block
26: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_expr
27: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_body
28: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_fn
29: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
30: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_item
31: rustc_hir::intravisit::walk_mod::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
32: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_item
33: rustc_hir::intravisit::walk_mod::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
34: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_item
35: rustc_hir::intravisit::walk_mod::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
36: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_item
37: rustc_hir::intravisit::walk_mod::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
38: rustc_lint::late::late_lint_pass_crate::<rustc_lint::late::LateLintPassObjects>
39: rustc_lint::late::late_lint_crate::<rustc_lint::BuiltinCombinedLateLintPass>
40: <rustc_session::session::Session>::time::<(), rustc_lint::late::check_crate<rustc_lint::BuiltinCombinedLateLintPass, rustc_interface::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}::{closure#0}>::{closure#0}::{closure#0}>
41: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}>
42: <core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::analysis::{closure#5}::{closure#1}> as core::ops::function::FnOnce<()>>::call_once
43: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#5}>
44: rustc_interface::passes::analysis
45: <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>>
46: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorGuaranteed>>>
47: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
48: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
49: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
50: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
51: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::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.66 (73c9eaf 2022-11-07)

query stack during panic:
#0 [try_destructure_mir_constant] destructuring MIR constant
#1 [analysis] running analysis passes on this crate
end of query stack

@paolobarbolini paolobarbolini added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Nov 8, 2022
@paolobarbolini paolobarbolini changed the title ICE with cargo clippy: thread '<unnamed>' panicked at 'forcing query with already existing DepNode`` ICE with cargo clippy: thread '<unnamed>' panicked at 'forcing query with already existing 'DepNode' Nov 8, 2022
@giraffate
Copy link
Contributor

Thanks for the report!

This seems to be similar to #9845. And there are reports that the latest nighlty has fixed this, so could you try it? #9845 (comment)

@paolobarbolini
Copy link
Contributor Author

I updated to the latest nightly and did a clean build, but it's still happening. I'll try to see if I can reduce it and post the code

@paolobarbolini
Copy link
Contributor Author

I was able to reduce it and I posted it in this repo:
https://github.com/paolobarbolini/rust-clippy-issue-9819-repro

@giraffate
Copy link
Contributor

#10131 looks like the same issue.

@dswij
Copy link
Member

dswij commented May 16, 2023

#10131 looks like the same issue.

And #10298

@Jarcho
Copy link
Contributor

Jarcho commented Mar 9, 2025

No longer reproduces on 1.84.1.

@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