Skip to content

ICE: itertools: .zip_eq() reached end of one iterator before the other #130372

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

mod to_reuse {

    pub fn variadic_fn(n: usize, mut args: ...) {}
}

reuse to_reuse::variadic_fn;

reuse fn_header_aux::unsafe_fn_extern;
reuse fn_header_aux::extern_fn_extern;
reuse fn_header_aux::variadic_fn_extern;
reuse fn_header_aux::const_fn_extern;
reuse fn_header_aux::async_fn_extern;

fn main() {
    unsafe {
        variadic_fn();
    }
}
original code

original:

//@ check-pass
//@ edition:2018
//@ aux-crate:fn_header_aux=fn-header-aux.rs

#![feature(c_variadic)]
#![feature(fn_delegation)]
#![allow(incomplete_features)]
#![deny(unused_unsafe)]

mod to_reuse {
    pub unsafe fn unsafe_fn() {}
    pub extern "C" fn extern_fn() {}
    pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) {}
    pub const fn const_fn() {}
    pub unsafe fn unsafe_fn() {}
}

reuse to_reuse::unsafe_fn;
reuse to_reuse::extern_fn;
reuse to_reuse::variadic_fn;
reuse to_reuse::const_fn;
reuse to_reuse::unsafe_fn;

reuse fn_header_aux::unsafe_fn_extern;
reuse fn_header_aux::extern_fn_extern;
reuse fn_header_aux::variadic_fn_extern;
reuse fn_header_aux::const_fn_extern;
reuse fn_header_aux::async_fn_extern;

const fn const_check() {
    const_fn();
    const_fn_extern();
}

async fn async_check() {
    async_fn().await;
    fn_header_aux::async_fn_extern;
}

fn main() {
    unsafe {
        unsafe_fn();
        unsafe_fn_extern();
    }
    extern_fn();
    extern_fn_extern();
    let _: extern "C" fn() = extern_fn;
    let _: extern "C" fn() = extern_fn_extern;
    unsafe {
        variadic_fn(0);
        variadic_fn();
        variadic_fn_extern(0);
        variadic_fn_extern(0, 1);
    }
    let _: unsafe extern "C" fn(usize, ...) = variadic_fn;
    let _: unsafe extern "C" fn(usize, ...) = variadic_fn_extern;
}

Version information

rustc 1.83.0-nightly (5e3ede22e 2024-09-14)
binary: rustc
commit-hash: 5e3ede22ef6fd23197629c22b9f466b3734e19f1
commit-date: 2024-09-14
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
 --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:3:34
  |
3 |     pub fn variadic_fn(n: usize, mut args: ...) {}
  |                                  ^^^^^^^^^^^^^

error[E0658]: functions delegation is not yet fully implemented
 --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:6:1
  |
6 | reuse to_reuse::variadic_fn;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
  = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
  = note: this compiler was built on 2024-09-14; consider upgrading it if it is out of date

error[E0658]: functions delegation is not yet fully implemented
 --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:8:1
  |
8 | reuse fn_header_aux::unsafe_fn_extern;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
  = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
  = note: this compiler was built on 2024-09-14; consider upgrading it if it is out of date

error[E0658]: functions delegation is not yet fully implemented
 --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:9:1
  |
9 | reuse fn_header_aux::extern_fn_extern;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
  = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
  = note: this compiler was built on 2024-09-14; consider upgrading it if it is out of date

error[E0658]: functions delegation is not yet fully implemented
  --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:10:1
   |
10 | reuse fn_header_aux::variadic_fn_extern;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
   = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
   = note: this compiler was built on 2024-09-14; consider upgrading it if it is out of date

error[E0658]: functions delegation is not yet fully implemented
  --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:11:1
   |
11 | reuse fn_header_aux::const_fn_extern;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
   = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
   = note: this compiler was built on 2024-09-14; consider upgrading it if it is out of date

error[E0658]: functions delegation is not yet fully implemented
  --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:12:1
   |
12 | reuse fn_header_aux::async_fn_extern;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
   = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
   = note: this compiler was built on 2024-09-14; consider upgrading it if it is out of date

error[E0658]: C-variadic functions are unstable
 --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:3:5
  |
3 |     pub fn variadic_fn(n: usize, mut args: ...) {}
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #44930 <https://github.com/rust-lang/rust/issues/44930> for more information
  = help: add `#![feature(c_variadic)]` to the crate attributes to enable
  = note: this compiler was built on 2024-09-14; consider upgrading it if it is out of date

thread 'rustc' panicked at /rust/deps/itertools-0.12.1/src/zip_eq_impl.rs:50:17:
itertools: .zip_eq() reached end of one iterator before the other
stack backtrace:
   0:     0x7924c407927a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h6120b7c64733b388
   1:     0x7924c4803257 - core::fmt::write::h04ec5344cbf9caeb
   2:     0x7924c5796233 - std::io::Write::write_fmt::h3c09d500ee92d83a
   3:     0x7924c40790d2 - std::sys::backtrace::BacktraceLock::print::h2fad0fa7205efa50
   4:     0x7924c407b851 - std::panicking::default_hook::{{closure}}::h4b479f759ddef1a6
   5:     0x7924c407b684 - std::panicking::default_hook::hdce79c09ea25303c
   6:     0x7924c317a70f - std[19c17663dd54327b]::panicking::update_hook::<alloc[5ed900dfc17f3cdd]::boxed::Box<rustc_driver_impl[1984b1857baa03d4]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7924c407bf78 - std::panicking::rust_panic_with_hook::ha97d2f186b78408e
   8:     0x7924c33ef36b - std[19c17663dd54327b]::panicking::begin_panic::<&str>::{closure#0}
   9:     0x7924c33a38a6 - std[19c17663dd54327b]::sys::backtrace::__rust_end_short_backtrace::<std[19c17663dd54327b]::panicking::begin_panic<&str>::{closure#0}, !>
  10:     0x7924c339a00f - std[19c17663dd54327b]::panicking::begin_panic::<&str>
  11:     0x7924c3418b39 - <itertools[ccdf881defd5b68f]::zip_eq_impl::ZipEq<alloc[5ed900dfc17f3cdd]::vec::into_iter::IntoIter<core[7a7dfcda68e5ea50]::option::Option<&rustc_hir[cd53a4d46407d6c]::hir::GenericParam>>, alloc[5ed900dfc17f3cdd]::vec::into_iter::IntoIter<&rustc_hir[cd53a4d46407d6c]::hir::Param>> as core[7a7dfcda68e5ea50]::iter::traits::iterator::Iterator>::next
  12:     0x7924c348e6ea - <rustc_hir_typeck[64ea15fc6d555141]::fn_ctxt::FnCtxt>::get_hir_params_with_generics
  13:     0x7924c348dc35 - <rustc_hir_typeck[64ea15fc6d555141]::fn_ctxt::FnCtxt>::label_generic_mismatches
  14:     0x7924c348531c - <rustc_hir_typeck[64ea15fc6d555141]::fn_ctxt::FnCtxt>::report_arg_errors
  15:     0x7924c0fe464b - <rustc_hir_typeck[64ea15fc6d555141]::fn_ctxt::FnCtxt>::confirm_builtin_call
  16:     0x7924c53f8054 - <rustc_hir_typeck[64ea15fc6d555141]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  17:     0x7924c53f167d - <rustc_hir_typeck[64ea15fc6d555141]::fn_ctxt::FnCtxt>::check_block_with_expected
  18:     0x7924c53f88c6 - <rustc_hir_typeck[64ea15fc6d555141]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  19:     0x7924c53f1750 - <rustc_hir_typeck[64ea15fc6d555141]::fn_ctxt::FnCtxt>::check_block_with_expected
  20:     0x7924c53f88c6 - <rustc_hir_typeck[64ea15fc6d555141]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21:     0x7924c48e34cd - rustc_hir_typeck[64ea15fc6d555141]::check::check_fn
  22:     0x7924c4acf8b2 - rustc_hir_typeck[64ea15fc6d555141]::typeck
  23:     0x7924c4acf2fb - rustc_query_impl[10f4610d82d1755]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[10f4610d82d1755]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b34bf39858087346]::query::erase::Erased<[u8; 8usize]>>
  24:     0x7924c4a8c37a - rustc_query_system[9b131319f03a3a86]::query::plumbing::try_execute_query::<rustc_query_impl[10f4610d82d1755]::DynamicConfig<rustc_query_system[9b131319f03a3a86]::query::caches::VecCache<rustc_span[47520046110495da]::def_id::LocalDefId, rustc_middle[b34bf39858087346]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[10f4610d82d1755]::plumbing::QueryCtxt, false>
  25:     0x7924c4a8af4d - rustc_query_impl[10f4610d82d1755]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  26:     0x7924c4a8abc7 - <rustc_middle[b34bf39858087346]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[da01e707c7998300]::check_crate::{closure#4}>::{closure#0}
  27:     0x7924c4a88a6e - rustc_hir_analysis[da01e707c7998300]::check_crate
  28:     0x7924c4a853c5 - rustc_interface[1be50e3bad7a611]::passes::run_required_analyses
  29:     0x7924c55b5f5e - rustc_interface[1be50e3bad7a611]::passes::analysis
  30:     0x7924c55b5f31 - rustc_query_impl[10f4610d82d1755]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[10f4610d82d1755]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b34bf39858087346]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7924c573b26e - rustc_query_system[9b131319f03a3a86]::query::plumbing::try_execute_query::<rustc_query_impl[10f4610d82d1755]::DynamicConfig<rustc_query_system[9b131319f03a3a86]::query::caches::SingleCache<rustc_middle[b34bf39858087346]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[10f4610d82d1755]::plumbing::QueryCtxt, false>
  32:     0x7924c573afcf - rustc_query_impl[10f4610d82d1755]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7924c55ae47c - rustc_interface[1be50e3bad7a611]::interface::run_compiler::<core[7a7dfcda68e5ea50]::result::Result<(), rustc_span[47520046110495da]::ErrorGuaranteed>, rustc_driver_impl[1984b1857baa03d4]::run_compiler::{closure#0}>::{closure#1}
  34:     0x7924c5675c50 - std[19c17663dd54327b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1be50e3bad7a611]::util::run_in_thread_with_globals<rustc_interface[1be50e3bad7a611]::util::run_in_thread_pool_with_globals<rustc_interface[1be50e3bad7a611]::interface::run_compiler<core[7a7dfcda68e5ea50]::result::Result<(), rustc_span[47520046110495da]::ErrorGuaranteed>, rustc_driver_impl[1984b1857baa03d4]::run_compiler::{closure#0}>::{closure#1}, core[7a7dfcda68e5ea50]::result::Result<(), rustc_span[47520046110495da]::ErrorGuaranteed>>::{closure#0}, core[7a7dfcda68e5ea50]::result::Result<(), rustc_span[47520046110495da]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7a7dfcda68e5ea50]::result::Result<(), rustc_span[47520046110495da]::ErrorGuaranteed>>
  35:     0x7924c56762ba - <<std[19c17663dd54327b]::thread::Builder>::spawn_unchecked_<rustc_interface[1be50e3bad7a611]::util::run_in_thread_with_globals<rustc_interface[1be50e3bad7a611]::util::run_in_thread_pool_with_globals<rustc_interface[1be50e3bad7a611]::interface::run_compiler<core[7a7dfcda68e5ea50]::result::Result<(), rustc_span[47520046110495da]::ErrorGuaranteed>, rustc_driver_impl[1984b1857baa03d4]::run_compiler::{closure#0}>::{closure#1}, core[7a7dfcda68e5ea50]::result::Result<(), rustc_span[47520046110495da]::ErrorGuaranteed>>::{closure#0}, core[7a7dfcda68e5ea50]::result::Result<(), rustc_span[47520046110495da]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7a7dfcda68e5ea50]::result::Result<(), rustc_span[47520046110495da]::ErrorGuaranteed>>::{closure#1} as core[7a7dfcda68e5ea50]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7924c56766ab - std::sys::pal::unix::thread::Thread::new::thread_start::h01e5f19adf5c8c06
  37:     0x7924c6d4c39d - <unknown>
  38:     0x7924c6dd149c - <unknown>
  39:                0x0 - <unknown>

error: 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: please make sure that you have updated to the latest nightly

note: rustc 1.83.0-nightly (5e3ede22e 2024-09-14) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error[E0433]: failed to resolve: use of undeclared crate or module `fn_header_aux`
 --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:8:7
  |
8 | reuse fn_header_aux::unsafe_fn_extern;
  |       ^^^^^^^^^^^^^ use of undeclared crate or module `fn_header_aux`

error[E0433]: failed to resolve: use of undeclared crate or module `fn_header_aux`
 --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:9:7
  |
9 | reuse fn_header_aux::extern_fn_extern;
  |       ^^^^^^^^^^^^^ use of undeclared crate or module `fn_header_aux`

error[E0433]: failed to resolve: use of undeclared crate or module `fn_header_aux`
  --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:10:7
   |
10 | reuse fn_header_aux::variadic_fn_extern;
   |       ^^^^^^^^^^^^^ use of undeclared crate or module `fn_header_aux`

error[E0433]: failed to resolve: use of undeclared crate or module `fn_header_aux`
  --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:11:7
   |
11 | reuse fn_header_aux::const_fn_extern;
   |       ^^^^^^^^^^^^^ use of undeclared crate or module `fn_header_aux`

error[E0433]: failed to resolve: use of undeclared crate or module `fn_header_aux`
  --> /tmp/icemaker_global_tempdir.m40eJ3wCJOgX/rustc_testrunner_tmpdir_reporting.Esu9dG5LhXST/mvce.rs:12:7
   |
12 | reuse fn_header_aux::async_fn_extern;
   |       ^^^^^^^^^^^^^ use of undeclared crate or module `fn_header_aux`

error: aborting due to 13 previous errors

Some errors have detailed explanations: E0433, E0658.
For more information about an error, try `rustc --explain E0433`.

@rustbot label +F-c_variadic +F-fn_delegation

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-c_variadic`#![feature(c_variadic)]`F-fn_delegation`#![feature(fn_delegation)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions