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

ICE - panic while trying to force a dep node #117903

Closed
Cryptex-github opened this issue Nov 14, 2023 · 3 comments
Closed

ICE - panic while trying to force a dep node #117903

Cryptex-github opened this issue Nov 14, 2023 · 3 comments
Labels
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

@Cryptex-github
Copy link

Cryptex-github commented Nov 14, 2023

Code

https://github.com/AdaptChat/harmony/tree/ice - repo where ICE happened.

I have attempted to create a minimal verifiable example, however, given this ICE involves async which makes it a lot harder to reproduce an example, I can't provide a minimal verifiable example at this moment.
However, I've done some investigations.

Likely originated from the tokio::main macro.

The error is related to:

match socket::accept(stream).await {

}

https://github.com/AdaptChat/harmony/blob/4782a856468dff82bd20a3fe2675306abd4cb4e3/src/main.rs#L27-L29

When the branches are left empty, the ICE is triggered. However, it disappears when the branches are filled in, e.g.:

match socket::accept(stream).await {
    Ok(_) => {},
    Err(_) => {},
}

It's extremely hard to reproduce and even one slight modification somewhere will cause the ICE to disappear.
Even then, the ICE isn't triggered single time, is very random.

Meta

rustc --version --verbose:

rustc 1.75.0-nightly (edf0b1db0 2023-11-10)
binary: rustc
commit-hash: edf0b1db0a7f29d71ee82cfc53bdc170fe74e501
commit-date: 2023-11-10
host: x86_64-pc-windows-msvc
release: 1.75.0-nightly
LLVM version: 17.0.4

I have the new parallel front-end on:

-Z threads=4

Error output

error: internal compiler error: compiler\rustc_mir_transform\src\coroutine.rs:1463:14: unexpected coroutine type Pin<&mut {async block@src\main.rs:9:1: 9:15}>
 --> src\main.rs:9:1
  |
9 | #[tokio::main]
  | ^^^^^^^^^^^^^^
  |
  = note: this error: internal compiler error originates in the attribute macro `tokio::main` (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at /rustc/edf0b1db0a7f29d71ee82cfc53bdc170fe74e501\compiler\rustc_errors\src\lib.rs:1000:33:
Box<dyn Any>
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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: please attach the file at `C:\Users\...\OneDrive\Desktop\repos\harmony\rustc-ice-2023-11-14T07_36_58-8752.txt` to your bug report

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -Z threads=4 -C target-cpu=native

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

query stack during panic:
#0 [mir_coroutine_witnesses] coroutine witness types for `main::{closure#0}`
#1 [dropck_outlives] computing dropck types for `{async block@src\main.rs:9:1: 9:15}`
#2 [mir_borrowck] borrow-checking `main`
#3 [analysis] running analysis passes on this crate
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 needs_drop_raw(a728502a26f3420b-f2514fc61b0d6e4e)
#1 dropck_outlives(61dd7136bcfdfb0b-d4f98cc665d05364)
end of try_mark_green dep node stack
For more information about this error, try `rustc --explain E0004`.
error: could not compile `harmony` (bin "harmony") due to previous error
Backtrace

thread 'rustc' panicked at /rustc/edf0b1db0a7f29d71ee82cfc53bdc170fe74e501\compiler\rustc_errors\src\lib.rs:1000:33:
Box<dyn Any>
stack backtrace:
   0:     0x7ffd5d34dc8f - std::backtrace::Backtrace::force_capture::h2dc498c6c0410861
   1:     0x7ffd5d34dbf4 - std::backtrace::Backtrace::force_capture::h2dc498c6c0410861
   2:     0x7ffd32978a89 - <tracing_subscriber[ffd73c18688ecb3]::fmt::format::Writer>::write_fmt
   3:     0x7ffd5d366793 - std::panicking::rust_panic_with_hook::h94b5f7224cb3ff18
   4:     0x7ffd32ec5738 - rustc_mir_transform[795bb961ec71e5b3]::dump_mir::emit_mir
   5:     0x7ffd32ec0139 - rustc_mir_transform[795bb961ec71e5b3]::dump_mir::emit_mir
   6:     0x7ffd32f0bc49 - <rustc_mir_transform[795bb961ec71e5b3]::elaborate_drops::Elaborator as rustc_mir_dataflow[521242e6f00060b2]::elaborate_drops::DropElaborator>::array_subpath
   7:     0x7ffd32e31bb6 - rustc_mir_transform[795bb961ec71e5b3]::coroutine::mir_coroutine_witnesses
   8:     0x7ffd32e31918 - rustc_mir_transform[795bb961ec71e5b3]::coroutine::mir_coroutine_witnesses
   9:     0x7ffd32f17137 - <rustc_mir_transform[795bb961ec71e5b3]::elaborate_drops::Elaborator as rustc_mir_dataflow[521242e6f00060b2]::elaborate_drops::DropElaborator>::array_subpath
  10:     0x7ffd32f1716d - <rustc_mir_transform[795bb961ec71e5b3]::elaborate_drops::Elaborator as rustc_mir_dataflow[521242e6f00060b2]::elaborate_drops::DropElaborator>::array_subpath
  11:     0x7ffd32f12baf - <rustc_mir_transform[795bb961ec71e5b3]::elaborate_drops::Elaborator as rustc_mir_dataflow[521242e6f00060b2]::elaborate_drops::DropElaborator>::array_subpath
  12:     0x7ffd32f12b56 - <rustc_mir_transform[795bb961ec71e5b3]::elaborate_drops::Elaborator as rustc_mir_dataflow[521242e6f00060b2]::elaborate_drops::DropElaborator>::array_subpath
  13:     0x7ffd32e2f6eb - rustc_mir_transform[795bb961ec71e5b3]::coroutine::mir_coroutine_witnesses
  14:     0x7ffd33487de2 - <rustc_query_impl[35472db2040f6fb3]::plumbing::QueryCtxt as rustc_query_system[ef2cca49b854d4d0]::query::QueryContext>::depth_limit_error
  15:     0x7ffd334d3903 - <rustc_query_impl[35472db2040f6fb3]::plumbing::QueryCtxt as rustc_query_system[ef2cca49b854d4d0]::query::QueryContext>::depth_limit_error
  16:     0x7ffd322ddde7 - <rustc_query_impl[35472db2040f6fb3]::plumbing::QueryCtxt as rustc_query_system[ef2cca49b854d4d0]::query::QueryContext>::load_side_effects
  17:     0x7ffd314db9fb - rustc_query_impl[35472db2040f6fb3]::profiling_support::alloc_self_profile_query_strings
  18:     0x7ffd3347429f - <rustc_span[7e835f1c7a87b780]::def_id::LocalDefId as rustc_query_impl[35472db2040f6fb3]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
  19:     0x7ffd3220f56b - <rustc_query_impl[35472db2040f6fb3]::plumbing::QueryCtxt as rustc_query_system[ef2cca49b854d4d0]::query::QueryContext>::load_side_effects
  20:     0x7ffd3220f503 - <rustc_query_impl[35472db2040f6fb3]::plumbing::QueryCtxt as rustc_query_system[ef2cca49b854d4d0]::query::QueryContext>::load_side_effects
  21:     0x7ffd3228b0be - <rustc_query_impl[35472db2040f6fb3]::plumbing::QueryCtxt as rustc_query_system[ef2cca49b854d4d0]::query::QueryContext>::load_side_effects
  22:     0x7ffd314aaed2 - rustc_query_impl[35472db2040f6fb3]::profiling_support::alloc_self_profile_query_strings
  23:     0x7ffd3239ff88 - <rustc_trait_selection[368ab61beacafc27]::traits::query::type_op::outlives::DropckOutlives as rustc_trait_selection[368ab61beacafc27]::traits::query::type_op::QueryTypeOp>::perform_query
  24:     0x7ffd321074ad - <rustc_borrowck[4a426328d0b3d822]::type_check::TypeVerifier as rustc_middle[82c1ebbbdf4dce5f]::mir::visit::Visitor>::visit_body
  25:     0x7ffd320a2199 - <rustc_middle[82c1ebbbdf4dce5f]::mir::syntax::Place as rustc_borrowck[4a426328d0b3d822]::place_ext::PlaceExt>::ignore_borrow
  26:     0x7ffd3212d05f - <rustc_borrowck[4a426328d0b3d822]::dataflow::Borrows as rustc_mir_dataflow[521242e6f00060b2]::framework::AnalysisDomain>::bottom_value
  27:     0x7ffd320a772f - <rustc_borrowck[4a426328d0b3d822]::type_check::relate_tys::NllTypeRelatingDelegate as rustc_infer[81cad9e7a7e159f0]::infer::nll_relate::TypeRelatingDelegate>::push_outlives
  28:     0x7ffd321509e1 - <rustc_borrowck[4a426328d0b3d822]::dataflow::Borrows as rustc_mir_dataflow[521242e6f00060b2]::framework::AnalysisDomain>::bottom_value
  29:     0x7ffd320617b6 - <rustc_borrowck[4a426328d0b3d822]::MirBorrowckCtxt>::consume_operand
  30:     0x7ffd32053e9d - rustc_borrowck[4a426328d0b3d822]::mir_borrowck
  31:     0x7ffd321f6c7f - <rustc_query_impl[35472db2040f6fb3]::plumbing::QueryCtxt as rustc_query_system[ef2cca49b854d4d0]::query::QueryContext>::load_side_effects
  32:     0x7ffd3224ecef - <rustc_query_impl[35472db2040f6fb3]::plumbing::QueryCtxt as rustc_query_system[ef2cca49b854d4d0]::query::QueryContext>::load_side_effects
  33:     0x7ffd3231b91e - <rustc_query_impl[35472db2040f6fb3]::plumbing::QueryCtxt as rustc_query_system[ef2cca49b854d4d0]::query::QueryContext>::load_side_effects
  34:     0x7ffd321ee5a9 - rustc_query_impl[35472db2040f6fb3]::query_callbacks
  35:     0x7ffd32aa4922 - rustc_interface[89de7afe51a89d52]::util::rustc_path
  36:     0x7ffd32aa0d16 - rustc_interface[89de7afe51a89d52]::util::rustc_path
  37:     0x7ffd32a9880f - rustc_interface[89de7afe51a89d52]::util::rustc_path
  38:     0x7ffd32aa4665 - rustc_interface[89de7afe51a89d52]::util::rustc_path
  39:     0x7ffd32a5805f - rustc_interface[89de7afe51a89d52]::util::rustc_path
  40:     0x7ffd32a2ce3f - rustc_interface[89de7afe51a89d52]::callbacks::dep_node_debug
  41:     0x7ffd32aa4665 - rustc_interface[89de7afe51a89d52]::util::rustc_path
  42:     0x7ffd32a5805f - rustc_interface[89de7afe51a89d52]::util::rustc_path
  43:     0x7ffd32a2ce3f - rustc_interface[89de7afe51a89d52]::callbacks::dep_node_debug
  44:     0x7ffd32aa7d7a - rustc_interface[89de7afe51a89d52]::util::rustc_path
  45:     0x7ffd32a581af - rustc_interface[89de7afe51a89d52]::util::rustc_path
  46:     0x7ffd32a2ce3f - rustc_interface[89de7afe51a89d52]::callbacks::dep_node_debug
  47:     0x7ffd32aad6c4 - rustc_interface[89de7afe51a89d52]::util::rustc_path
  48:     0x7ffd34084226 - <rayon_core[8e66855e2256e1de]::registry::WorkerThread>::wait_until_cold
  49:     0x7ffd34082640 - <rayon_core[8e66855e2256e1de]::registry::ThreadBuilder>::run
  50:     0x7ffd32939062 - <rustc_data_structures[4f732dd8ecc90bbe]::hashes::Hash128 as core[8266382edb2bb7ea]::fmt::Debug>::fmt
  51:     0x7ffd32959f7a - <rustc_data_structures[4f732dd8ecc90bbe]::hashes::Hash128 as core[8266382edb2bb7ea]::fmt::Debug>::fmt
  52:     0x7ffd3297879d - <rustc_data_structures[4f732dd8ecc90bbe]::hashes::Hash128 as core[8266382edb2bb7ea]::fmt::Debug>::fmt
  53:     0x7ffd3291d4d9 - rustc_driver_impl[6c8bd495863d11da]::init_env_logger
  54:     0x7ffd32953d0b - <rustc_data_structures[4f732dd8ecc90bbe]::hashes::Hash128 as core[8266382edb2bb7ea]::fmt::Debug>::fmt
  55:     0x7ffd3291d6a7 - rustc_driver_impl[6c8bd495863d11da]::init_env_logger
  56:     0x7ffd5d3789fc - std::sys::windows::thread::Thread::new::h67dfe1634550644f
  57:     0x7ffdb60e7614 - BaseThreadInitThunk
  58:     0x7ffdb6da26f1 - RtlUserThreadStart


rustc version: 1.75.0-nightly (edf0b1db0 2023-11-10)
platform: x86_64-pc-windows-msvc

query stack during panic:
#0 [mir_coroutine_witnesses] coroutine witness types for `main::{closure#0}`
#1 [dropck_outlives] computing dropck types for `{async block@src\main.rs:9:1: 9:15}`
#2 [mir_borrowck] borrow-checking `main`
#3 [analysis] running analysis passes on this crate
end of query stack

@Cryptex-github Cryptex-github 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 Nov 14, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 14, 2023
@lqd
Copy link
Member

lqd commented Nov 14, 2023

Looks like a duplicate of #117670 which should be fixed by #117686

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 15, 2023
@jruderman
Copy link
Contributor

Cryptex, can you check whether your ICE is fixed in a newer nightly, now that #117686 is in?

@Cryptex-github
Copy link
Author

Cryptex, can you check whether your ICE is fixed in a newer nightly, now that #117686 is in?

This ICE seems to be gone as of rustc 1.76.0-nightly (6b771f6b5 2023-11-15), or at least I can't reproduce it anymore.
Feel free to close this if you'd like, thanks.

@lqd lqd closed this as completed Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

5 participants