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

Compiler panik #130771

Closed
marchaesen opened this issue Sep 24, 2024 · 3 comments
Closed

Compiler panik #130771

marchaesen opened this issue Sep 24, 2024 · 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

@marchaesen
Copy link

Code

zbus-4.3.1

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (7042c269c 2024-09-23)
binary: rustc
commit-hash: 7042c269c166191cd5d8daf0409890903df7af57
commit-date: 2024-09-23
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Error output

thread 'rustc' panicked at compiler/rustc_mir_transform/src/validate.rs:152:26:
broken MIR in Item(DefId(0:1241 ~ zbus[b508]::connection::{impl#1}::poll_before)) (after phase change to runtime-optimized) at bb32[2]:
Normal edge to BasicBlockData { statements: [StorageDead(_46)], terminator: Some(Terminator { source_info: SourceInfo { span: /home/mahae/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-4.3.1/src/connection/mod.rs:267:13: 267:14 (#0), scope: scope[2] }, kind: goto -> bb37 }), is_cleanup: false } violates unwind invariants (cleanup true -> false)
stack backtrace:
   0:     0x726737e8832a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::haf9d4ce087fe74a0
   1:     0x726738603666 - core::fmt::write::h6d8d6eef4a4af1ac
   2:     0x726739725db3 - std::io::Write::write_fmt::h9c1a7b2c301e0052
   3:     0x726737e88182 - std::sys::backtrace::BacktraceLock::print::h5a5be8b1e95a2bbb
   4:     0x726737e8a901 - std::panicking::default_hook::{{closure}}::ha72f3fa07467f26a
   5:     0x726737e8a734 - std::panicking::default_hook::hcc7760cf4378effc
   6:     0x726736f8286f - std[25b33fdea409b280]::panicking::update_hook::<alloc[1694921db2598cc8]::boxed::Box<rustc_driver_impl[91319f0e19a4d720]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x726737e8b018 - std::panicking::rust_panic_with_hook::hfa739d875be2cf67
   8:     0x726737e8adea - std::panicking::begin_panic_handler::{{closure}}::h9a9134f6e05b41bd
   9:     0x726737e887d9 - std::sys::backtrace::__rust_end_short_backtrace::h35fa4dfdd9fe9e0c
  10:     0x726737e8aaac - rust_begin_unwind
  11:     0x72673569e7b0 - core::panicking::panic_fmt::hc3e7c6c5c469a97f
  12:     0x726735cb311a - <rustc_mir_transform[2c59a960358d0625]::validate::Validator as rustc_mir_transform[2c59a960358d0625]::pass_manager::MirPass>::run_pass
  13:     0x72673860dc64 - rustc_mir_transform[2c59a960358d0625]::pass_manager::run_passes_inner
  14:     0x726739003922 - rustc_mir_transform[2c59a960358d0625]::optimized_mir
  15:     0x7267390021db - rustc_query_impl[16add4a89c515f02]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[16add4a89c515f02]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 8usize]>>
  16:     0x726738631eae - rustc_query_system[cd92c81c02f5c019]::query::plumbing::try_execute_query::<rustc_query_impl[16add4a89c515f02]::DynamicConfig<rustc_query_system[cd92c81c02f5c019]::query::caches::DefIdCache<rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[16add4a89c515f02]::plumbing::QueryCtxt, false>
  17:     0x72673863145f - rustc_query_impl[16add4a89c515f02]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  18:     0x72673863624e - rustc_middle[5962dfe9f3174182]::query::plumbing::query_get_at::<rustc_query_system[cd92c81c02f5c019]::query::caches::DefIdCache<rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 8usize]>>>
  19:     0x726735bf49c4 - rustc_mir_transform[2c59a960358d0625]::cross_crate_inline::cross_crate_inlinable
  20:     0x72673896e985 - rustc_query_impl[16add4a89c515f02]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[16add4a89c515f02]::query_impl::cross_crate_inlinable::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 1usize]>>
  21:     0x72673896cd4b - rustc_query_system[cd92c81c02f5c019]::query::plumbing::try_execute_query::<rustc_query_impl[16add4a89c515f02]::DynamicConfig<rustc_query_system[cd92c81c02f5c019]::query::caches::DefIdCache<rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[16add4a89c515f02]::plumbing::QueryCtxt, false>
  22:     0x72673896c90a - rustc_query_impl[16add4a89c515f02]::query_impl::cross_crate_inlinable::get_query_non_incr::__rust_end_short_backtrace
  23:     0x726738850506 - rustc_passes[6167bbd13d80a6b8]::reachable::reachable_set
  24:     0x7267394c75e4 - rustc_query_impl[16add4a89c515f02]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[16add4a89c515f02]::query_impl::reachable_set::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 8usize]>>
  25:     0x7267394c4f79 - rustc_query_system[cd92c81c02f5c019]::query::plumbing::try_execute_query::<rustc_query_impl[16add4a89c515f02]::DynamicConfig<rustc_query_system[cd92c81c02f5c019]::query::caches::SingleCache<rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[16add4a89c515f02]::plumbing::QueryCtxt, false>
  26:     0x7267394c479e - rustc_query_impl[16add4a89c515f02]::query_impl::reachable_set::get_query_non_incr::__rust_end_short_backtrace
  27:     0x72673901180d - <rustc_metadata[bda71c6b2cfd99ea]::rmeta::encoder::EncodeContext>::encode_crate_root
  28:     0x7267396b8ad3 - rustc_metadata[bda71c6b2cfd99ea]::rmeta::encoder::encode_metadata
  29:     0x7267396c0f54 - rustc_metadata[bda71c6b2cfd99ea]::fs::encode_and_write_metadata
  30:     0x7267396bfd43 - <rustc_interface[1294e3f809d58823]::queries::Linker>::codegen_and_build_linker
  31:     0x72673932a34b - rustc_interface[1294e3f809d58823]::interface::run_compiler::<core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>, rustc_driver_impl[91319f0e19a4d720]::run_compiler::{closure#0}>::{closure#1}
  32:     0x7267393bf210 - std[25b33fdea409b280]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1294e3f809d58823]::util::run_in_thread_with_globals<rustc_interface[1294e3f809d58823]::util::run_in_thread_pool_with_globals<rustc_interface[1294e3f809d58823]::interface::run_compiler<core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>, rustc_driver_impl[91319f0e19a4d720]::run_compiler::{closure#0}>::{closure#1}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>::{closure#0}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>
  33:     0x7267393bf87a - <<std[25b33fdea409b280]::thread::Builder>::spawn_unchecked_<rustc_interface[1294e3f809d58823]::util::run_in_thread_with_globals<rustc_interface[1294e3f809d58823]::util::run_in_thread_pool_with_globals<rustc_interface[1294e3f809d58823]::interface::run_compiler<core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>, rustc_driver_impl[91319f0e19a4d720]::run_compiler::{closure#0}>::{closure#1}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>::{closure#0}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>::{closure#1} as core[1e18fbba9f4dcc19]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7267393bfc6b - std::sys::pal::unix::thread::Thread::new::thread_start::h9c0c387d4b02e16a
  35:     0x72673369ca94 - start_thread
                               at ./nptl/pthread_create.c:447:8
  36:     0x726733729c3c - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
  37:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

query stack during panic:
#0 [optimized_mir] optimizing MIR for `connection::<impl at /home/mahae/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-4.3.1/src/connection/mod.rs:224:1: 224:41>::poll_before`
#1 [cross_crate_inlinable] whether the item should be made inlinable across crates
end of query stack
error: could not compile `zbus` (lib)

Caused by:
  process didn't exit successfully: `/home/mahae/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name zbus --edition=2021 /home/mahae/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zbus-4.3.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=429 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C linker-plugin-lto --cfg 'feature="async-executor"' --cfg 'feature="async-fs"' --cfg 'feature="async-io"' --cfg 'feature="async-lock"' --cfg 'feature="async-task"' --cfg 'feature="blocking"' --cfg 'feature="default"' --cfg 'feature="p2p"' --cfg 'feature="tokio"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("async-executor", "async-fs", "async-io", "async-lock", "async-task", "blocking", "bus-impl", "chrono", "default", "option-as-array", "p2p", "time", "tokio", "tokio-vsock", "url", "uuid", "vsock"))' -C metadata=df8c2a6ad203480b -C extra-filename=-df8c2a6ad203480b --out-dir /home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps -C strip=debuginfo -L dependency=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps --extern async_broadcast=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libasync_broadcast-19c6c94e22dc4612.rmeta --extern async_executor=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libasync_executor-b5fce626394a8e6e.rmeta --extern async_fs=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libasync_fs-6b06d6b8175d1a66.rmeta --extern async_io=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libasync_io-9c2b264733a7f79c.rmeta --extern async_lock=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libasync_lock-fdf997aa53be6439.rmeta --extern async_task=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libasync_task-65ba5b08a00c7445.rmeta --extern async_trait=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libasync_trait-3eb51dc7349b3e75.so --extern blocking=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libblocking-f517ccdc585441ef.rmeta --extern enumflags2=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libenumflags2-8167047b49ad9c5d.rmeta --extern event_listener=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libevent_listener-49d32eb10b3f238e.rmeta --extern futures_core=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libfutures_core-b0fcc2873dd71452.rmeta --extern futures_sink=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libfutures_sink-3360660325a85320.rmeta --extern futures_util=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libfutures_util-4bf754e22b2afdf2.rmeta --extern hex=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libhex-79bf15cc3175fb84.rmeta --extern nix=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libnix-a703d54645ec6359.rmeta --extern ordered_stream=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libordered_stream-2b2a47c53de9941f.rmeta --extern rand=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/librand-28edf560f9f2ad56.rmeta --extern serde=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libserde-e298b37eeb899258.rmeta --extern serde_repr=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libserde_repr-83670111cec13fe7.so --extern sha1=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libsha1-79655af2e2d59a65.rmeta --extern static_assertions=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libstatic_assertions-dae8998ed3d24486.rmeta --extern tokio=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libtokio-96b590ce7892f632.rmeta --extern tracing=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libtracing-52e00b385fa53a5b.rmeta --extern xdg_home=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libxdg_home-336161d55e44e5c6.rmeta --extern zbus_macros=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libzbus_macros-ea9d81b986d86fd0.so --extern zbus_names=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libzbus_names-7e603de0b01cd5cf.rmeta --extern zvariant=/home/mahae/cosmicde/cosmic-epoch/cosmic-applets/target/release/deps/libzvariant-3c9ef6b5119faca5.rmeta --cap-lints allow` (exit status: 101)

Backtrace

<backtrace>

[rustc-ice-2024-09-24T06_26_12-625182.txt](https://github.com/user-attachments/files/17109319/rustc-ice-2024-09-24T06_26_12-625182.txt)
@marchaesen marchaesen 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 Sep 24, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 24, 2024
@theemathas
Copy link
Contributor

Likely a duplicate of #130769

jieyouxu added a commit to jieyouxu/rust that referenced this issue Sep 24, 2024
…h_scalar, r=cjgillot"

This reverts commit a772336, reversing
changes made to 702987f.

It seems Apply EarlyOtherwiseBranch to scalar value rust-lang#129047 may have
lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

And since this is a mir-opt ICE that seems to quite easy to trigger with
real-world crates being affected, let's revert for now and reland the
mir-opt later.
jieyouxu added a commit to jieyouxu/rust that referenced this issue Sep 24, 2024
…h_scalar, r=cjgillot"

This reverts commit a772336, reversing
changes made to 702987f.

It seems Apply EarlyOtherwiseBranch to scalar value rust-lang#129047 may have
lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

And since this is a mir-opt ICE that seems to quite easy to trigger with
real-world crates being affected, let's revert for now and reland the
mir-opt later.
@jieyouxu jieyouxu added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Sep 24, 2024
@theemathas
Copy link
Contributor

Minimized:

use std::task::Poll;

pub enum PollResult<Data> {
    Item { data: Data },
    NoneBefore,
}

pub fn foo<Message>(value: Poll<PollResult<Result<Message, ()>>>) {
    match value {
        Poll::Ready(PollResult::Item { data: Ok(msg) }) => {}
        Poll::Ready(PollResult::Item { data: Err(e) }) => {}
        Poll::Ready(PollResult::NoneBefore) => {}
        Poll::Pending => {}
    }
}

To reproduce the ICE: cargo +nightly build --release

@rustbot labels -E-needs-mcve

@rustbot rustbot removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Sep 24, 2024
@jieyouxu
Copy link
Member

Yep, the code pattern looks exactly like the minimization for #130769. Closing as duplicate.

@jieyouxu jieyouxu closed this as not planned Won't fix, can't repro, duplicate, stale Sep 24, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 24, 2024
Revert "Apply EarlyOtherwiseBranch to scalar value rust-lang#129047"

This reverts PR rust-lang#129047, commit a772336, reversing changes made to 702987f.

cc `@DianQK` and `@cjgillot` as the PR author and reviewer of rust-lang#129047 respectively.

It seems [Apply EarlyOtherwiseBranch to scalar value rust-lang#129047](rust-lang#129047) may have lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

Example test that would ICE with changes in rust-lang#129047 (this test is included in this PR):

```rs
//@ compile-flags: -C opt-level=3
//@ check-pass

use std::task::Poll;

pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) {
    match val {
        Poll::Ready(Ok(Some(_trailers))) => {}
        Poll::Ready(Err(_err)) => {}
        Poll::Ready(Ok(None)) => {}
        Poll::Pending => {}
    }
}
```

Since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt after these are fixed.
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 24, 2024
Revert "Apply EarlyOtherwiseBranch to scalar value rust-lang#129047"

This reverts PR rust-lang#129047, commit a772336, reversing changes made to 702987f.

cc `@DianQK` and `@cjgillot` as the PR author and reviewer of rust-lang#129047 respectively.

It seems [Apply EarlyOtherwiseBranch to scalar value rust-lang#129047](rust-lang#129047) may have lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

Example test that would ICE with changes in rust-lang#129047 (this test is included in this PR):

```rs
//@ compile-flags: -C opt-level=3
//@ check-pass

use std::task::Poll;

pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) {
    match val {
        Poll::Ready(Ok(Some(_trailers))) => {}
        Poll::Ready(Err(_err)) => {}
        Poll::Ready(Ok(None)) => {}
        Poll::Pending => {}
    }
}
```

Since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt after these are fixed.
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 25, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Sep 25, 2024
Revert "Apply EarlyOtherwiseBranch to scalar value #129047"

This reverts PR #129047, commit a772336fb3fbd1fe4493077fcfe04e0221296a99, reversing changes made to 702987f75b74f789ba227ee04a3d7bb1680c2309.

cc `@DianQK` and `@cjgillot` as the PR author and reviewer of #129047 respectively.

It seems [Apply EarlyOtherwiseBranch to scalar value #129047](rust-lang/rust#129047) may have lead to several nightly regressions:

- rust-lang/rust#130769
- rust-lang/rust#130774
- rust-lang/rust#130771

Example test that would ICE with changes in #129047 (this test is included in this PR):

```rs
//@ compile-flags: -C opt-level=3
//@ check-pass

use std::task::Poll;

pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) {
    match val {
        Poll::Ready(Ok(Some(_trailers))) => {}
        Poll::Ready(Err(_err)) => {}
        Poll::Ready(Ok(None)) => {}
        Poll::Pending => {}
    }
}
```

Since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt after these are fixed.
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