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: unexpected body ty: {type error} phase Runtime(PostCleanup) #120816

Closed
matthiaskrgr opened this issue Feb 8, 2024 · 1 comment · Fixed by #120817
Closed

ICE: unexpected body ty: {type error} phase Runtime(PostCleanup) #120816

matthiaskrgr opened this issue Feb 8, 2024 · 1 comment · Fixed by #120817
Assignees
Labels
-Zvalidate-mir Unstable option: MIR validation 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 a() {}

fn _test<'a>() {
    baz(|| 45);
}

original:

fn a() {}

fn baz<F: Fn(*mut &a)>(_: F) {}
fn _test<'a>(f:  u128  (a, a) ) {
    baz(|_: &(u16, u16)| 45);
}

Version information

rustc 1.78.0-nightly (98aa3624b 2024-02-08)
binary: rustc
commit-hash: 98aa3624be70462d6a25ed5544333e3df62f4c66
commit-date: 2024-02-08
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zvalidate-mir

Program output

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

error[E0425]: cannot find function `baz` in this scope
 --> /tmp/icemaker_global_tempdir.OfKKAInz3FRR/rustc_testrunner_tmpdir_reporting.OKTLF5I7SskN/mvce.rs:4:5
  |
4 |     baz(|| 45);
  |     ^^^ not found in this scope

error: internal compiler error: compiler/rustc_const_eval/src/transform/validate.rs:64:21: unexpected body ty: {type error} phase Runtime(PostCleanup)
 --> /tmp/icemaker_global_tempdir.OfKKAInz3FRR/rustc_testrunner_tmpdir_reporting.OKTLF5I7SskN/mvce.rs:4:9
  |
4 |     baz(|| 45);
  |         ^^

thread 'rustc' panicked at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/compiler/rustc_middle/src/util/bug.rs:34:50:
Box<dyn Any>
stack backtrace:
   0:     0x7f155bf83dd6 - std::backtrace_rs::backtrace::libunwind::trace::hcf4842620364d535
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f155bf83dd6 - std::backtrace_rs::backtrace::trace_unsynchronized::h615a7d3c4b72d07a
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f155bf83dd6 - std::sys_common::backtrace::_print_fmt::h777946980bbce9d4
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f155bf83dd6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0fdadf67cf82c3e5
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f155bfd6830 - core::fmt::rt::Argument::fmt::h40bec717748a6a66
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/core/src/fmt/rt.rs:142:9
   5:     0x7f155bfd6830 - core::fmt::write::hfb3923fb2f513fc0
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f155bf7764f - std::io::Write::write_fmt::h7dd8ba1b7fdc9479
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/io/mod.rs:1854:15
   7:     0x7f155bf83bb4 - std::sys_common::backtrace::_print::hffce9865d8ccd857
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f155bf83bb4 - std::sys_common::backtrace::print::h532d3566cc4254d4
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f155bf86947 - std::panicking::default_hook::{{closure}}::hfa7000b32c4e888b
  10:     0x7f155bf866a9 - std::panicking::default_hook::haaf1b4b762fde1ac
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/panicking.rs:292:9
  11:     0x7f1558d3b78c - std[5c40b41967587ec6]::panicking::update_hook::<alloc[5d4b954b8b3d7648]::boxed::Box<rustc_driver_impl[ab5bb327712dbf0b]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f155bf87096 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h4c230f69fdc2df31
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/alloc/src/boxed.rs:2029:9
  13:     0x7f155bf87096 - std::panicking::rust_panic_with_hook::h89e8d9a00153591c
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/panicking.rs:785:13
  14:     0x7f1558d6d214 - std[5c40b41967587ec6]::panicking::begin_panic::<rustc_errors[2d943f9bbf936830]::ExplicitBug>::{closure#0}
  15:     0x7f1558d69c46 - std[5c40b41967587ec6]::sys_common::backtrace::__rust_end_short_backtrace::<std[5c40b41967587ec6]::panicking::begin_panic<rustc_errors[2d943f9bbf936830]::ExplicitBug>::{closure#0}, !>
  16:     0x7f1558d695f6 - std[5c40b41967587ec6]::panicking::begin_panic::<rustc_errors[2d943f9bbf936830]::ExplicitBug>
  17:     0x7f1558d78e71 - <rustc_errors[2d943f9bbf936830]::diagnostic_builder::BugAbort as rustc_errors[2d943f9bbf936830]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f1558cc73ad - rustc_middle[d2b54ada19c9e5f1]::util::bug::opt_span_bug_fmt::<rustc_span[e69a7bbb34a31e54]::span_encoding::Span>::{closure#0}
  19:     0x7f1558cc73da - rustc_middle[d2b54ada19c9e5f1]::ty::context::tls::with_opt::<rustc_middle[d2b54ada19c9e5f1]::util::bug::opt_span_bug_fmt<rustc_span[e69a7bbb34a31e54]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7f1558cbedb8 - rustc_middle[d2b54ada19c9e5f1]::ty::context::tls::with_context_opt::<rustc_middle[d2b54ada19c9e5f1]::ty::context::tls::with_opt<rustc_middle[d2b54ada19c9e5f1]::util::bug::opt_span_bug_fmt<rustc_span[e69a7bbb34a31e54]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7f15581cdd14 - rustc_middle[d2b54ada19c9e5f1]::util::bug::span_bug_fmt::<rustc_span[e69a7bbb34a31e54]::span_encoding::Span>
  22:     0x7f155a5e06f7 - <rustc_const_eval[d3b6b2ab9b56d607]::transform::validate::Validator as rustc_middle[d2b54ada19c9e5f1]::mir::MirPass>::run_pass
  23:     0x7f155a0125e3 - rustc_mir_transform[dbe325d144a46723]::pass_manager::run_passes_inner
  24:     0x7f155744f530 - rustc_mir_transform[dbe325d144a46723]::mir_drops_elaborated_and_const_checked
  25:     0x7f155a18c035 - rustc_query_impl[99ac65c25f06845a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[99ac65c25f06845a]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d2b54ada19c9e5f1]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7f155a18c2ba - rustc_query_system[98dc65aab34f8a4c]::query::plumbing::try_execute_query::<rustc_query_impl[99ac65c25f06845a]::DynamicConfig<rustc_query_system[98dc65aab34f8a4c]::query::caches::VecCache<rustc_span[e69a7bbb34a31e54]::def_id::LocalDefId, rustc_middle[d2b54ada19c9e5f1]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[99ac65c25f06845a]::plumbing::QueryCtxt, false>
  27:     0x7f155a18bb94 - rustc_query_impl[99ac65c25f06845a]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f155a9632ed - rustc_interface[f5c5c4389ec3cf3a]::passes::analysis
  29:     0x7f155a9629df - rustc_query_impl[99ac65c25f06845a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[99ac65c25f06845a]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d2b54ada19c9e5f1]::query::erase::Erased<[u8; 1usize]>>
  30:     0x7f155ad0a5b2 - rustc_query_system[98dc65aab34f8a4c]::query::plumbing::try_execute_query::<rustc_query_impl[99ac65c25f06845a]::DynamicConfig<rustc_query_system[98dc65aab34f8a4c]::query::caches::SingleCache<rustc_middle[d2b54ada19c9e5f1]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[99ac65c25f06845a]::plumbing::QueryCtxt, false>
  31:     0x7f155ad0a315 - rustc_query_impl[99ac65c25f06845a]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f155ad173f6 - rustc_interface[f5c5c4389ec3cf3a]::interface::run_compiler::<core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>, rustc_driver_impl[ab5bb327712dbf0b]::run_compiler::{closure#0}>::{closure#0}
  33:     0x7f155a9a9386 - std[5c40b41967587ec6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f5c5c4389ec3cf3a]::util::run_in_thread_with_globals<rustc_interface[f5c5c4389ec3cf3a]::util::run_in_thread_pool_with_globals<rustc_interface[f5c5c4389ec3cf3a]::interface::run_compiler<core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>, rustc_driver_impl[ab5bb327712dbf0b]::run_compiler::{closure#0}>::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>
  34:     0x7f155a9a91b3 - <<std[5c40b41967587ec6]::thread::Builder>::spawn_unchecked_<rustc_interface[f5c5c4389ec3cf3a]::util::run_in_thread_with_globals<rustc_interface[f5c5c4389ec3cf3a]::util::run_in_thread_pool_with_globals<rustc_interface[f5c5c4389ec3cf3a]::interface::run_compiler<core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>, rustc_driver_impl[ab5bb327712dbf0b]::run_compiler::{closure#0}>::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>::{closure#1} as core[2f2a284c56ca7af5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x7f155bf90735 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd35908ec403131f0
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/alloc/src/boxed.rs:2015:9
  36:     0x7f155bf90735 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6d654616ee0757b9
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/alloc/src/boxed.rs:2015:9
  37:     0x7f155bf90735 - std::sys::pal::unix::thread::Thread::new::thread_start::h987e3b25a01ed571
                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys/pal/unix/thread.rs:108:17
  38:     0x7f1555e6f9eb - <unknown>
  39:     0x7f1555ef37cc - <unknown>
  40:                0x0 - <unknown>

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 (98aa3624b 2024-02-08) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z validate-mir -Z dump-mir-dir=dir

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `_test::{closure#0}`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

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

@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 8, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 8, 2024
@matthiaskrgr
Copy link
Member Author

cc @oli-obk :D (note you'll need #120807 which was merged 10 minutes ago ^^ )

@compiler-errors compiler-errors self-assigned this Feb 9, 2024
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 9, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 9, 2024
…=oli-obk

Fix more `ty::Error` ICEs in MIR passes

Fixes rust-lang#120791 - Add a check for `ty::Error` in the `ByMove` coroutine pass
Fixes rust-lang#120816 - Add a check for `ty::Error` in the MIR validator

Also a drive-by fix for a FIXME I had asked oli to add

r? oli-obk
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 9, 2024
…=oli-obk

Fix more `ty::Error` ICEs in MIR passes

Fixes rust-lang#120791 - Add a check for `ty::Error` in the `ByMove` coroutine pass
Fixes rust-lang#120816 - Add a check for `ty::Error` in the MIR validator

Also a drive-by fix for a FIXME I had asked oli to add

r? oli-obk
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 9, 2024
…=oli-obk

Fix more `ty::Error` ICEs in MIR passes

Fixes rust-lang#120791 - Add a check for `ty::Error` in the `ByMove` coroutine pass
Fixes rust-lang#120816 - Add a check for `ty::Error` in the MIR validator

Also a drive-by fix for a FIXME I had asked oli to add

r? oli-obk
@bors bors closed this as completed in 116efb5 Feb 9, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 9, 2024
Rollup merge of rust-lang#120817 - compiler-errors:more-mir-errors, r=oli-obk

Fix more `ty::Error` ICEs in MIR passes

Fixes rust-lang#120791 - Add a check for `ty::Error` in the `ByMove` coroutine pass
Fixes rust-lang#120816 - Add a check for `ty::Error` in the MIR validator

Also a drive-by fix for a FIXME I had asked oli to add

r? oli-obk
@fmease fmease added -Zvalidate-mir Unstable option: MIR validation and removed C-bug Category: This is a bug. labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Zvalidate-mir Unstable option: MIR validation 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