Skip to content

Panic while compiling http-body v0.4.6 with rustc 1.83.0-nightly (7042c269c 2024-09-23) #130769

Closed
1 of 1 issue completed

Description

@arpankapoor

Code

Clone http-body, checkout v0.4.6 and compile in release mode:

$ git clone https://github.com/hyperium/http-body.git
$ cd http-body
$ git checkout v0.4.6
$ cargo build --release

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:23 ~ http_body[d100]::collect::{impl#1}::poll)) (after phase change to runtime-optimized) at bb22[2]:
Normal edge to BasicBlockData { statements: [StorageDead(_46)], terminator: Some(Terminator { source_info: SourceInfo { span: src/collect.rs:69:13: 69:14 (#0), scope: scope[1] }, kind: goto -> bb41 }), is_cleanup: false } violates unwind invariants (cleanup true -> false)
stack backtrace:
   0:     0x7fe9e4c02f25 - std::backtrace::Backtrace::create::h8d365723131839b0
   1:     0x7fe9e32738a5 - std::backtrace::Backtrace::force_capture::ha8b2c128ac653152
   2:     0x7fe9e2382ea4 - std[25b33fdea409b280]::panicking::update_hook::<alloc[1694921db2598cc8]::boxed::Box<rustc_driver_impl[91319f0e19a4d720]::install_ice_hook::{closure#0}>>::{closure#0}
   3:     0x7fe9e328b018 - std::panicking::rust_panic_with_hook::hfa739d875be2cf67
   4:     0x7fe9e328adea - std::panicking::begin_panic_handler::{{closure}}::h9a9134f6e05b41bd
   5:     0x7fe9e32887d9 - std::sys::backtrace::__rust_end_short_backtrace::h35fa4dfdd9fe9e0c
   6:     0x7fe9e328aaac - rust_begin_unwind
   7:     0x7fe9e0a9e7b0 - core::panicking::panic_fmt::hc3e7c6c5c469a97f
   8:     0x7fe9e10b311a - <rustc_mir_transform[2c59a960358d0625]::validate::Validator as rustc_mir_transform[2c59a960358d0625]::pass_manager::MirPass>::run_pass
   9:     0x7fe9e3a0dc64 - rustc_mir_transform[2c59a960358d0625]::pass_manager::run_passes_inner
  10:     0x7fe9e4403922 - rustc_mir_transform[2c59a960358d0625]::optimized_mir
  11:     0x7fe9e44021db - 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]>>
  12:     0x7fe9e3a31eae - 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>
  13:     0x7fe9e3a3145f - rustc_query_impl[16add4a89c515f02]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  14:     0x7fe9e440e963 - rustc_middle[5962dfe9f3174182]::query::plumbing::query_get_at::<rustc_query_system[cd92c81c02f5c019]::query::caches::DefIdCache<rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 8usize]>>>
  15:     0x7fe9e4416305 - <rustc_metadata[bda71c6b2cfd99ea]::rmeta::encoder::EncodeContext>::encode_crate_root
  16:     0x7fe9e4ab8ad3 - rustc_metadata[bda71c6b2cfd99ea]::rmeta::encoder::encode_metadata
  17:     0x7fe9e4ac0f54 - rustc_metadata[bda71c6b2cfd99ea]::fs::encode_and_write_metadata
  18:     0x7fe9e4abfd43 - <rustc_interface[1294e3f809d58823]::queries::Linker>::codegen_and_build_linker
  19:     0x7fe9e472a34b - rustc_interface[1294e3f809d58823]::interface::run_compiler::<core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>, rustc_driver_impl[91319f0e19a4d720]::run_compiler::{closure#0}>::{closure#1}
  20:     0x7fe9e47bf210 - 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>>
  21:     0x7fe9e47bf87a - <<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}
  22:     0x7fe9e47bfc6b - std::sys::pal::unix::thread::Thread::new::thread_start::h9c0c387d4b02e16a
  23:     0x7fe9e5fd16d7 - start_thread
  24:     0x7fe9e605560c - __clone3
  25:                0x0 - <unknown>


rustc version: 1.83.0-nightly (7042c269c 2024-09-23)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [optimized_mir] optimizing MIR for `collect::<impl at src/collect.rs:37:1: 37:36>::poll`
end of query stack
Backtrace

<backtrace>

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Sep 24, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 24, 2024
  3. theemathas commented on Sep 24, 2024

    @theemathas
    Contributor

    Minimized:

    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 => {}
        }
    }

    Run cargo +nightly build --release to reproduce the ICE

  4. theemathas commented on Sep 24, 2024

    @theemathas
    Contributor

    @rustbot labels +regression-from-stable-to-nightly

  5. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Sep 24, 2024
  6. jieyouxu commented on Sep 24, 2024

    @jieyouxu
    Member

    searched nightlies: from nightly-2024-09-20 to nightly-2024-09-24
    regressed nightly: nightly-2024-09-24
    searched commit range: 6c6d210...7042c26
    regressed commit: a772336

    bisected with cargo-bisect-rustc v0.6.8

    Host triple: aarch64-unknown-linux-gnu
    Reproduce with:

    cargo bisect-rustc --regress=ice -- build --release
  7. added
    A-mir-optArea: MIR optimizations
    S-has-bisectionStatus: A bisection has been found for this issue
    on Sep 24, 2024
  8. jieyouxu commented on Sep 24, 2024

    @jieyouxu
    Member

    Might be #129047 cc @dianqk

  9. apiraino commented on Sep 24, 2024

    @apiraino
    Contributor

    WG-prioritization assigning priority (Zulip discussion).

    @rustbot label -I-prioritize +P-critical

  10. added and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Sep 24, 2024
  11. 8 remaining items

  12. HTGAzureX1212 commented on Sep 24, 2024

    @HTGAzureX1212
    Contributor

    Just encountered this now, posting the GitHub Actions log: https://github.com/HTGAzureX1212/HarTex/actions/runs/11014828619/job/30586387526

    This seems to not only be happening to http-body but to some other crates as well (in the log above, twilight-http).

  13. theemathas commented on Sep 24, 2024

    @theemathas
    Contributor

    The problematic part of twilight-http has the exact same pattern of nested match patterns https://github.com/twilight-rs/twilight/blob/9147a49e2f96f4cde9be3fc48dda42dd5fecd3e1/twilight-http/src/response/future.rs#L84

  14. dianqk commented on Sep 24, 2024

    @dianqk
    Member

    #130786 should fix this. I will rebase after #130775 merged.

  15. added a commit that references this issue on Sep 24, 2024
  16. wesleywiser commented on Sep 26, 2024

    @wesleywiser
    Member

    Fixed by #130775 which reverted the change and added the minimized reproducer to the test suite. Thanks @jieyouxu!

  17. added a commit that references this issue on Dec 18, 2024
    2d08e94
  18. added a commit that references this issue on Dec 18, 2024
    525aeb9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-mir-optArea: MIR optimizationsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-criticalCritical priorityS-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions