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: errors.is_empty() #120864

Closed
matthiaskrgr opened this issue Feb 10, 2024 · 2 comments · Fixed by #121032
Closed

ICE: errors.is_empty() #120864

matthiaskrgr opened this issue Feb 10, 2024 · 2 comments · Fixed by #121032
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints 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

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

fn thing(, , ) {
    
    thing(y);
    
    
    let f = | _ , y: &u32 , z | ();
    f(f);
    
    
    
    
}

original:

fn main() {
    let f = | _ , y: &u32 , z | ();
    thing(f);
    //~^ ERROR mismatched types
    //~^^ ERROR mismatched types
    let f = | x, y: _  , z: u32 | ();
    thing(f);
    //~^ ERROR mismatched types
    //~^^ ERROR mismatched types
    //~^^^ ERROR implementation of `FnOnce` is not general enough
    //~^^^^ ERROR implementation of `FnOnce` is not general enough
}

fn thing(&u32, &u32, u32) {
    let f = | x, y: _  , z: u32 | ();
    thing(y);
    //~^ ERROR mismatched types
    //~^^ ERROR mismatched types
    let f = | _ , y: &u32 , z | ();
    f(f);
    //~^ ERROR mismatched types
    //~^^ ERROR mismatched types
    //~^^^ ERROR implementation of `FnOnce` is not general enough
    //~^^^ ERROR implementation of `FnOnce` is not general enough
}

Version information

rustc 1.78.0-nightly (d44e3b95c 2024-02-09)
binary: rustc
commit-hash: d44e3b95cb9d410d89cb8ab3233906a33f43756a
commit-date: 2024-02-09
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6

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

Program output

error: expected parameter name, found `,`
 --> /tmp/icemaker_global_tempdir.OLgkezOQldBU/rustc_testrunner_tmpdir_reporting.n81illt6jime/mvce.rs:3:10
  |
3 | fn thing(, , ) {
  |          ^ expected parameter name

error: expected parameter name, found `,`
 --> /tmp/icemaker_global_tempdir.OLgkezOQldBU/rustc_testrunner_tmpdir_reporting.n81illt6jime/mvce.rs:3:12
  |
3 | fn thing(, , ) {
  |            ^ expected parameter name

error[E0425]: cannot find value `y` in this scope
 --> /tmp/icemaker_global_tempdir.OLgkezOQldBU/rustc_testrunner_tmpdir_reporting.n81illt6jime/mvce.rs:5:11
  |
5 |     thing(y);
  |           ^ not found in this scope

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.OLgkezOQldBU/rustc_testrunner_tmpdir_reporting.n81illt6jime/mvce.rs:14:2
   |
14 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.OLgkezOQldBU/rustc_testrunner_tmpdir_reporting.n81illt6jime/mvce.rs`

error[E0061]: this function takes 2 arguments but 1 argument was supplied
 --> /tmp/icemaker_global_tempdir.OLgkezOQldBU/rustc_testrunner_tmpdir_reporting.n81illt6jime/mvce.rs:5:5
  |
5 |     thing(y);
  |     ^^^^^--- an argument is missing
  |
note: function defined here
 --> /tmp/icemaker_global_tempdir.OLgkezOQldBU/rustc_testrunner_tmpdir_reporting.n81illt6jime/mvce.rs:3:4
  |
3 | fn thing(, , ) {
  |    ^^^^^--
help: provide the argument
  |
5 |     thing(y, /*  */);
  |          ~~~~~~~~~~~

error[E0644]: closure/coroutine type that references itself
 --> /tmp/icemaker_global_tempdir.OLgkezOQldBU/rustc_testrunner_tmpdir_reporting.n81illt6jime/mvce.rs:9:7
  |
9 |     f(f);
  |       ^ cyclic type of infinite size
  |
  = note: closures cannot capture themselves or take themselves as argument;
          this error may be the result of a recent compiler bug-fix,
          see issue #46062 <https://github.com/rust-lang/rust/issues/46062>
          for more information

thread 'rustc' panicked at compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:744:13:
assertion failed: errors.is_empty()
stack backtrace:
   0:     0x7f06eb38b936 - std::backtrace_rs::backtrace::libunwind::trace::ha4e340d83956b6a7
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f06eb38b936 - std::backtrace_rs::backtrace::trace_unsynchronized::h496689f2269fc1f9
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f06eb38b936 - std::sys_common::backtrace::_print_fmt::h5b8d6425acdf9de2
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f06eb38b936 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd1632d07f3024207
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f06eb3de380 - core::fmt::rt::Argument::fmt::h4f261889e80f123d
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/core/src/fmt/rt.rs:142:9
   5:     0x7f06eb3de380 - core::fmt::write::h9bbd14542dbf2e7c
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f06eb37f17f - std::io::Write::write_fmt::hdb4a9a1a30b52b2c
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/io/mod.rs:1854:15
   7:     0x7f06eb38b714 - std::sys_common::backtrace::_print::h016f2aaf70be80f8
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f06eb38b714 - std::sys_common::backtrace::print::hb9713787207c076b
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f06eb38e4d7 - std::panicking::default_hook::{{closure}}::h34ca11fbc6eb460e
  10:     0x7f06eb38e239 - std::panicking::default_hook::h3e49d202ffbf9a64
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/panicking.rs:292:9
  11:     0x7f06ee128a0c - std[4cb245a8c4fcbb2b]::panicking::update_hook::<alloc[4a1fa2d365a8ec83]::boxed::Box<rustc_driver_impl[d92334f8e0b5c69f]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f06eb38ec26 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h70b0dd5af17047ec
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/alloc/src/boxed.rs:2029:9
  13:     0x7f06eb38ec26 - std::panicking::rust_panic_with_hook::h5268464aa60f9bc8
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/panicking.rs:785:13
  14:     0x7f06eb38e939 - std::panicking::begin_panic_handler::{{closure}}::he52b5ce078558996
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/panicking.rs:651:13
  15:     0x7f06eb38be36 - std::sys_common::backtrace::__rust_end_short_backtrace::hbaa37bd2889680bf
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f06eb38e6c4 - rust_begin_unwind
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/panicking.rs:647:5
  17:     0x7f06eb3daa85 - core::panicking::panic_fmt::h3038ea3ffe8e8b7b
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/core/src/panicking.rs:72:14
  18:     0x7f06eb3dab43 - core::panicking::panic::hc8c01b4595b452f9
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/core/src/panicking.rs:144:5
  19:     0x7f06ee2fa9c0 - <rustc_hir_typeck[5a9ec5ed1d72bd50]::fn_ctxt::FnCtxt>::report_arg_errors
  20:     0x7f06eff263c6 - <rustc_hir_typeck[5a9ec5ed1d72bd50]::fn_ctxt::FnCtxt>::check_argument_types
  21:     0x7f06efd165f8 - <rustc_hir_typeck[5a9ec5ed1d72bd50]::fn_ctxt::FnCtxt>::check_call
  22:     0x7f06efed20a2 - <rustc_hir_typeck[5a9ec5ed1d72bd50]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:     0x7f06efdeb323 - <rustc_hir_typeck[5a9ec5ed1d72bd50]::fn_ctxt::FnCtxt>::check_block_with_expected
  24:     0x7f06efed27d6 - <rustc_hir_typeck[5a9ec5ed1d72bd50]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  25:     0x7f06ef9f3d23 - rustc_hir_typeck[5a9ec5ed1d72bd50]::check::check_fn
  26:     0x7f06ef541f62 - rustc_hir_typeck[5a9ec5ed1d72bd50]::typeck
  27:     0x7f06ef5412bd - rustc_query_impl[24bd5f0faa3cd235]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[24bd5f0faa3cd235]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f70515e6cf4402ab]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7f06ef5c5d3a - rustc_query_system[89d43ac98090ee26]::query::plumbing::try_execute_query::<rustc_query_impl[24bd5f0faa3cd235]::DynamicConfig<rustc_query_system[89d43ac98090ee26]::query::caches::VecCache<rustc_span[d717321976fe2f69]::def_id::LocalDefId, rustc_middle[f70515e6cf4402ab]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[24bd5f0faa3cd235]::plumbing::QueryCtxt, false>
  29:     0x7f06ef5c5850 - rustc_query_impl[24bd5f0faa3cd235]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7f06ef5c4fd6 - <rustc_middle[f70515e6cf4402ab]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[979456e231b5f247]::check_crate::{closure#5}>::{closure#0}
  31:     0x7f06ef5c3b0e - rustc_hir_analysis[979456e231b5f247]::check_crate
  32:     0x7f06efddfa12 - rustc_interface[e833383f6d6bccbe]::passes::analysis
  33:     0x7f06efddf65f - rustc_query_impl[24bd5f0faa3cd235]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[24bd5f0faa3cd235]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f70515e6cf4402ab]::query::erase::Erased<[u8; 1usize]>>
  34:     0x7f06f0108db2 - rustc_query_system[89d43ac98090ee26]::query::plumbing::try_execute_query::<rustc_query_impl[24bd5f0faa3cd235]::DynamicConfig<rustc_query_system[89d43ac98090ee26]::query::caches::SingleCache<rustc_middle[f70515e6cf4402ab]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[24bd5f0faa3cd235]::plumbing::QueryCtxt, false>
  35:     0x7f06f0108b15 - rustc_query_impl[24bd5f0faa3cd235]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7f06f0117b82 - rustc_interface[e833383f6d6bccbe]::interface::run_compiler::<core[9c9cc17aadeb336b]::result::Result<(), rustc_span[d717321976fe2f69]::ErrorGuaranteed>, rustc_driver_impl[d92334f8e0b5c69f]::run_compiler::{closure#0}>::{closure#0}
  37:     0x7f06f0393306 - std[4cb245a8c4fcbb2b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e833383f6d6bccbe]::util::run_in_thread_with_globals<rustc_interface[e833383f6d6bccbe]::util::run_in_thread_pool_with_globals<rustc_interface[e833383f6d6bccbe]::interface::run_compiler<core[9c9cc17aadeb336b]::result::Result<(), rustc_span[d717321976fe2f69]::ErrorGuaranteed>, rustc_driver_impl[d92334f8e0b5c69f]::run_compiler::{closure#0}>::{closure#0}, core[9c9cc17aadeb336b]::result::Result<(), rustc_span[d717321976fe2f69]::ErrorGuaranteed>>::{closure#0}, core[9c9cc17aadeb336b]::result::Result<(), rustc_span[d717321976fe2f69]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9c9cc17aadeb336b]::result::Result<(), rustc_span[d717321976fe2f69]::ErrorGuaranteed>>
  38:     0x7f06f0393133 - <<std[4cb245a8c4fcbb2b]::thread::Builder>::spawn_unchecked_<rustc_interface[e833383f6d6bccbe]::util::run_in_thread_with_globals<rustc_interface[e833383f6d6bccbe]::util::run_in_thread_pool_with_globals<rustc_interface[e833383f6d6bccbe]::interface::run_compiler<core[9c9cc17aadeb336b]::result::Result<(), rustc_span[d717321976fe2f69]::ErrorGuaranteed>, rustc_driver_impl[d92334f8e0b5c69f]::run_compiler::{closure#0}>::{closure#0}, core[9c9cc17aadeb336b]::result::Result<(), rustc_span[d717321976fe2f69]::ErrorGuaranteed>>::{closure#0}, core[9c9cc17aadeb336b]::result::Result<(), rustc_span[d717321976fe2f69]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9c9cc17aadeb336b]::result::Result<(), rustc_span[d717321976fe2f69]::ErrorGuaranteed>>::{closure#1} as core[9c9cc17aadeb336b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7f06eb397eb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9eb8a991c9116b63
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/alloc/src/boxed.rs:2015:9
  40:     0x7f06eb397eb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8c75f09e06980632
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/alloc/src/boxed.rs:2015:9
  41:     0x7f06eb397eb5 - std::sys::pal::unix::thread::Thread::new::thread_start::hdaf36e3abe8ac6ae
                               at /rustc/d44e3b95cb9d410d89cb8ab3233906a33f43756a/library/std/src/sys/pal/unix/thread.rs:108:17
  42:     0x7f06eb1819eb - <unknown>
  43:     0x7f06eb2057cc - <unknown>
  44:                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: rustc 1.78.0-nightly (d44e3b95c 2024-02-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `thing`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors

Some errors have detailed explanations: E0061, E0425, E0601, E0644.
For more information about an error, try `rustc --explain E0061`.

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Feb 10, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 10, 2024
@matthiaskrgr
Copy link
Member Author

fn thing() {
    let f = | _,_ | ();
    f(f);
}

@matthiaskrgr
Copy link
Member Author

#120342 cc @oli-obk

@saethlin saethlin added A-diagnostics Area: Messages for errors, warnings, and lints and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 10, 2024
@oli-obk oli-obk self-assigned this Feb 10, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 19, 2024
@bors bors closed this as completed in 25bba60 Feb 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 19, 2024
Rollup merge of rust-lang#121032 - oli-obk:cyclic_type_ice, r=cjgillot

Continue reporting remaining errors instead of silently dropping them

I was too eager to add assertions in https://github.com/rust-lang/rust/pull/120342/files#diff-593003090e0fb5c21f31413ce5feb506e235ec33c4775da88b853980429b9ff1R741

fixes rust-lang#120864
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints 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

Successfully merging a pull request may close this issue.

4 participants