Closed zvkemp closed 1 year ago
@zvkemp Can you try the following to see if you can reproduce this again:
cargo clean
ApplicationSummaryKey
back to its original location, and undo any other changes you made)cargo build
from the workspace rootApplicationSummaryKey
to the new location)cargo build
again@aaron1101 Unfortunately I can't reproduce the issue again using that procedure; in hindsight I should have copied the target directory state before running cargo clean. I'll reply to this issue again if I end up getting it working (or rather not working).
I think I ran across the same issue, but it was after switching git branches multiple times so finding a reproduction seems hard :( I ran cargo test
in crate-a
and while cargo was compiling crate-b
i got:
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/compiler/rustc_hir/src/definitions.rs:452:14
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.58.0 (02072b482 2022-01-11) running on x86_64-apple-darwin
note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [unsafety_check_result] unsafety-checking `handler::account::account_get::{closure#0}`
#1 [unsafety_check_result] unsafety-checking `handler::account::account_get`
end of query stack
error: could not compile `crate-b`
a clean build resolved it.
I've had another panic with a similar stacktrace, again after globally renaming a struct. This one is only triggered by cargo test
.
@aaron1101 I've backed up the target directory this time, so please let me know if there's anything you'd like me to look at in more detail.
```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/compiler/rustc_hir/src/definitions.rs:452:14
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic
3:
@zvkemp Are you able to consistently reproduce the crash after running cargo clean
by re-applying the sequence of building and editing that you performed?
I've just had it too, going to try cargo clean
afterwards:
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/compiler/rustc_hir/src/definitions.rs:452:14
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.58.0 (02072b482 2022-01-11) 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 [evaluate_obligation] evaluating trait selection obligation `impl core::future::future::Future<Output = core::result::Result<alloc::boxed::Box<(dyn warp::reply::Reply + 'static)>, core::convert::Infallible>>: core::marker::Send` | = note: this failure-note originates in the macro `mk_route` (in Nightly builds, run with -Z macro-backtrace for more info)
#1 [typeck] type-checking `api::run`
end of query stack
EDIT:
cargo clean
did fix it.
I was refactoring some things and moved a module inside another directory. I think that was the trigger.
Same thing here, but cargo clean
fixed it. I had a not-too-old git-commit, so I tried to do:
git stash
cargo clean
cargo build
git stash pop
cargo build
But it didn't trigger the error...
Same here.
Running cargo test
after an important refactoring made rustc
panic on x86_64-pc-windows-msvc
.
Without thinking twice I ran cargo clean
and that fixed everything, so I assume it was some intermediate files which were inconsistent, maybe caused by rust analyzer running cargo check
while editing?
Anyway, the gist is that I can't provide a minimal source code reproing because 1) it seems unrelated to the specific source code 2) if clean fixes, code probably wouldn't repro anyway.
rustc --version --verbose
:
rustc 1.58.0 (02072b482 2022-01-11)
binary: rustc
commit-hash: 02072b482a8b5357f7fb5e5637444ae30e423c40
commit-date: 2022-01-11
host: x86_64-pc-windows-msvc
release: 1.58.0
LLVM version: 13.0.0
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40\compiler\rustc_hir\src\definitions.rs:452:14
```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40\compiler\rustc_hir\src\definitions.rs:452:14
stack backtrace:
0: 0x7ffd2ba19c3f -
I have an open source crate having this problem in https://github.com/manishearth/icu4x/tree/ice-dep-hash : cd utils/zerovec && cargo check --all-features
I'm unable to reproduce after cargo clean, but the last commit is what caused the ICE
This is almost certainly a duplicate of this issue and was probably resolved in this PR:
Code
Code is part of a private repo, so I can't share everything. The change involved moving a struct definition (the
ApplicationSummaryKey
in the below example) from one module to a new submodule of that module. It is triggered bycargo build
orcargo test
(possibly other commands). Was not triggered by nightly, but it's unclear if that's because there wasn't a stale nightly build already.This is the function at the top of the query stack when the panic occurs:
Also note this crate is part of a workspace, and the panic only happens when run from the workspace root; it does not happen if run in the crate's subdirectory. A
cargo clean -p {crate}
fixed the issue, and now I cannot reproduce it.Meta
rustc --version --verbose
:Error output
Backtrace
``` stack backtrace: 0: _rust_begin_unwind 1: core::panicking::panic_fmt 2: core::panicking::panic 3:::def_path_hash_to_def_id
4: as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_id
5: rustc_query_impl::query_callbacks::hir_owner::force_from_dep_node
6: ::try_force_from_dep_node
7: >::try_mark_previous_green::
8: >::try_mark_previous_green::
9: >::try_mark_previous_green::
10: >::try_mark_green::
11: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory::
12: rustc_query_system::query::plumbing::try_execute_query::>
13: rustc_query_system::query::plumbing::get_query::
14: ::visit_rvalue
15: rustc_mir_transform::check_unsafety::unsafety_check_result
16: >::call_once
17: >::with_task::
18: rustc_data_structures::stack::ensure_sufficient_stack::<(&rustc_middle::mir::query::UnsafetyCheckResult, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job::{closure#3}>
19: rustc_query_system::query::plumbing::try_execute_query::>
20: rustc_query_system::query::plumbing::force_query::
21: rustc_query_impl::query_callbacks::unsafety_check_result::force_from_dep_node
22: ::try_force_from_dep_node
23: >::try_mark_previous_green::
24: >::try_mark_previous_green::
25: >::try_mark_previous_green::
26: >::try_mark_green::
27: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory::
28: rustc_query_system::query::plumbing::try_execute_query::>
29: rustc_query_system::query::plumbing::get_query::
30: rustc_typeck::collect::type_of::type_of
31: >::with_task::
32: rustc_data_structures::stack::ensure_sufficient_stack::<(&rustc_middle::ty::TyS, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job::{closure#3}>
33: rustc_query_system::query::plumbing::try_execute_query::>
34: rustc_query_system::query::plumbing::get_query::
35: ::expand_opaque_ty
36: as core::iter::traits::collect::Extend<&rustc_middle::ty::TyS>>::extend::>, ru
stc_middle::ty::util::fold_list as rustc_middle::ty::fold::TypeFoldable>::super_fold_with::{closure#0}>::{closure#1}>>
37: rustc_middle::ty::util::fold_list:: as rustc_middle::ty::fold::TypeFoldable>::super_fold_with::{closure#0}>
38: <&rustc_middle::ty::TyS as rustc_middle::ty::fold::TypeFoldable>::super_fold_with::
39: as core::iter::traits::collect::Extend>::extend::>, <&rustc_middle::ty::list::List as rustc_middle::ty::fold::TypeFoldable>::super_fold_with::{closure#0}>>
40: <&rustc_middle::ty::list::List as rustc_middle::ty::fold::TypeFoldable>::fold_with::
41: <&rustc_middle::ty::TyS as rustc_middle::ty::fold::TypeFoldable>::super_fold_with::
42: <&rustc_middle::ty::list::List as rustc_middle::ty::fold::TypeFoldable>::fold_with::
43: ::expand_opaque_ty
44: ::expand_opaque_ty
45: ::try_expand_impl_trait_type
46: rustc_typeck::check::check::check_item_type
47: ::visit_item_likes_in_module::
48: rustc_typeck::check::check::check_mod_item_types
49: >::with_task::
50: rustc_data_structures::stack::ensure_sufficient_stack::<((), rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job::{clo
sure#3}>
51: rustc_query_system::query::plumbing::try_execute_query::>
52: rustc_query_system::query::plumbing::get_query::
53: ::for_each_module::
54: rustc_typeck::check_crate
55: rustc_interface::passes::analysis
56: >::with_task::>
57: rustc_data_structures::stack::ensure_sufficient_stack::<(core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job>::{closure#3}>
58: rustc_query_system::query::plumbing::try_execute_query::>>
59: rustc_query_system::query::plumbing::get_query::
60: ::enter::>
61: ::enter::, rustc_errors::ErrorReported>>
62: rustc_span::with_source_map::, rustc_interface::interface::create_compiler_and_run, rustc_driver::run_compiler::{closure#1}>::{closure#
1}>
63: >::set::, rustc_driver:
:run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [unsafety_check_result] unsafety-checking `rollups::rollup_buffer::::commit_buffer_in_transaction::{closure#0}`
#1 [unsafety_check_result] unsafety-checking `rollups::rollup_buffer::::commit_buffer_in_transaction`
#2 [mir_borrowck] borrow-checking `rollups::rollup_buffer::::commit_buffer_in_transaction`
#3 [type_of] computing type of `rollups::rollup_buffer::::commit_buffer_in_transaction::{opaque#0}`
#4 [check_mod_item_types] checking item types in top-level module
#5 [analysis] running analysis passes on this crate
```