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: argument to transmute has inference variables #123461

Closed
matthiaskrgr opened this issue Apr 4, 2024 · 3 comments · Fixed by #123531
Closed

ICE: argument to transmute has inference variables #123461

matthiaskrgr opened this issue Apr 4, 2024 · 3 comments · Fixed by #123531
Assignees
Labels
A-hir Area: The high-level intermediate representation (HIR) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

snippet:

fn main() {
    let _: [_; unsafe { std::mem::transmute(|o_b: Option<_>| {}) }];
}

Version information

rustc 1.79.0-nightly (a77322c16 2024-04-02)
binary: rustc
commit-hash: a77322c16f188402fa22a5e87100acce42433cbc
commit-date: 2024-04-02
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2

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

Program output

error: internal compiler error: argument to transmute has inference variables
 --> /tmp/icemaker_global_tempdir.IcHxd1IVykWP/rustc_testrunner_tmpdir_reporting.j8kfnlKQF91a/mvce.rs:2:25
  |
2 |     let _: [_; unsafe { std::mem::transmute(|o_b: Option<_>| {}) }];
  |                         ^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_hir_typeck/src/intrinsicck.rs:54:23:
Box<dyn Any>
stack backtrace:
   0:     0x7f35d039cab5 - std::backtrace_rs::backtrace::libunwind::trace::hf26b8e97f4d981a3
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7f35d039cab5 - std::backtrace_rs::backtrace::trace_unsynchronized::h257c3a9fcc68cb34
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f35d039cab5 - std::sys_common::backtrace::_print_fmt::h78d592e526d576cc
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f35d039cab5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h406a266f6476e993
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f35d03ebcfb - core::fmt::rt::Argument::fmt::h7950f9cc4e18eb74
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/core/src/fmt/rt.rs:142:9
   5:     0x7f35d03ebcfb - core::fmt::write::hf6d8222a297fe1b5
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/core/src/fmt/mod.rs:1153:17
   6:     0x7f35d039169f - std::io::Write::write_fmt::h2e25e66707b8719c
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/std/src/io/mod.rs:1843:15
   7:     0x7f35d039c88e - std::sys_common::backtrace::_print::h93052b2b7ae3e225
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f35d039c88e - std::sys_common::backtrace::print::h2c3363fe806c95b9
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f35d039f2d9 - std::panicking::default_hook::{{closure}}::hccbad107bfb00663
  10:     0x7f35d039f043 - std::panicking::default_hook::h0629782f23910600
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/std/src/panicking.rs:291:9
  11:     0x7f35ccc0344f - std[cd169797441e4304]::panicking::update_hook::<alloc[80a8ff80e015276]::boxed::Box<rustc_driver_impl[4156c2df247de3fc]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f35d039f9dc - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfd80129a92e7f542
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/alloc/src/boxed.rs:2032:9
  13:     0x7f35d039f9dc - std::panicking::rust_panic_with_hook::hbdb3c4b71c4fae93
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/std/src/panicking.rs:792:13
  14:     0x7f35ccc33224 - std[cd169797441e4304]::panicking::begin_panic::<rustc_errors[36548b9f9a9ea726]::ExplicitBug>::{closure#0}
  15:     0x7f35ccc30146 - std[cd169797441e4304]::sys_common::backtrace::__rust_end_short_backtrace::<std[cd169797441e4304]::panicking::begin_panic<rustc_errors[36548b9f9a9ea726]::ExplicitBug>::{closure#0}, !>
  16:     0x7f35ccc2fe26 - std[cd169797441e4304]::panicking::begin_panic::<rustc_errors[36548b9f9a9ea726]::ExplicitBug>
  17:     0x7f35ccc3c641 - <rustc_errors[36548b9f9a9ea726]::diagnostic::BugAbort as rustc_errors[36548b9f9a9ea726]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f35ccd633fc - <rustc_errors[36548b9f9a9ea726]::DiagCtxt>::span_bug::<rustc_span[abf425ab4de01d9]::span_encoding::Span, &str>
  19:     0x7f35ce7fd76b - <rustc_hir_typeck[312bf9d4ee85e4af]::fn_ctxt::FnCtxt>::check_transmute
  20:     0x7f35ce219892 - rustc_hir_typeck[312bf9d4ee85e4af]::typeck
  21:     0x7f35ce217557 - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>
  22:     0x7f35ce2044f1 - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::VecCache<rustc_span[abf425ab4de01d9]::def_id::LocalDefId, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  23:     0x7f35ce20094c - rustc_query_impl[f27b006aa91c0ba0]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7f35ce30e608 - rustc_mir_build[af64b97e60cfd821]::thir::pattern::check_match::check_match
  25:     0x7f35ce30d77b - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::check_match::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 1usize]>>
  26:     0x7f35ce71227b - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::VecCache<rustc_span[abf425ab4de01d9]::def_id::LocalDefId, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  27:     0x7f35ce711fd5 - rustc_query_impl[f27b006aa91c0ba0]::query_impl::check_match::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f35ce301cb3 - rustc_mir_build[af64b97e60cfd821]::build::mir_build
  29:     0x7f35ce301146 - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>
  30:     0x7f35ce2044f1 - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::VecCache<rustc_span[abf425ab4de01d9]::def_id::LocalDefId, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  31:     0x7f35ce2040cc - rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f35ce203df5 - rustc_middle[f32ad3853e76b525]::query::plumbing::query_get_at::<rustc_query_system[e2bc6f1fc30f6df]::query::caches::VecCache<rustc_span[abf425ab4de01d9]::def_id::LocalDefId, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>>
  33:     0x7f35ce703e01 - rustc_mir_transform[22a0d5156851a26f]::mir_const_qualif
  34:     0x7f35ce703daf - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_const_qualif::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 4usize]>>
  35:     0x7f35ce70388e - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::DefIdCache<rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 4usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  36:     0x7f35ce703609 - rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_const_qualif::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7f35ce703436 - rustc_middle[f32ad3853e76b525]::query::plumbing::query_get_at::<rustc_query_system[e2bc6f1fc30f6df]::query::caches::DefIdCache<rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 4usize]>>>
  38:     0x7f35cbb13d06 - rustc_mir_transform[22a0d5156851a26f]::mir_promoted
  39:     0x7f35ce2e5292 - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 16usize]>>
  40:     0x7f35ce2e5549 - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::VecCache<rustc_span[abf425ab4de01d9]::def_id::LocalDefId, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  41:     0x7f35ce2e518f - rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7f35ce202672 - rustc_borrowck[248ed8311a6775a9]::mir_borrowck
  43:     0x7f35ce2025a7 - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>
  44:     0x7f35ce2044f1 - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::VecCache<rustc_span[abf425ab4de01d9]::def_id::LocalDefId, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  45:     0x7f35ce20400c - rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  46:     0x7f35ce70b02b - rustc_mir_transform[22a0d5156851a26f]::mir_drops_elaborated_and_const_checked
  47:     0x7f35ce70a72f - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>
  48:     0x7f35ce2044f1 - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::VecCache<rustc_span[abf425ab4de01d9]::def_id::LocalDefId, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  49:     0x7f35ce203e9c - rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  50:     0x7f35ce203df5 - rustc_middle[f32ad3853e76b525]::query::plumbing::query_get_at::<rustc_query_system[e2bc6f1fc30f6df]::query::caches::VecCache<rustc_span[abf425ab4de01d9]::def_id::LocalDefId, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>>
  51:     0x7f35ce7094ec - rustc_mir_transform[22a0d5156851a26f]::mir_for_ctfe
  52:     0x7f35ce709465 - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_for_ctfe::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>
  53:     0x7f35ce1b4c1e - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::DefIdCache<rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  54:     0x7f35ceba79de - rustc_query_impl[f27b006aa91c0ba0]::query_impl::mir_for_ctfe::get_query_non_incr::__rust_end_short_backtrace
  55:     0x7f35ceba7d0a - <rustc_const_eval[b66d8613139a267c]::interpret::eval_context::InterpCx<rustc_const_eval[b66d8613139a267c]::const_eval::machine::CompileTimeInterpreter>>::load_mir
  56:     0x7f35ceba9b1b - rustc_const_eval[b66d8613139a267c]::const_eval::eval_queries::eval_to_allocation_raw_provider
  57:     0x7f35ceba987c - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 24usize]>>
  58:     0x7f35ceba68d6 - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::DefaultCache<rustc_middle[f32ad3853e76b525]::ty::ParamEnvAnd<rustc_middle[f32ad3853e76b525]::mir::interpret::GlobalId>, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  59:     0x7f35ceba64ac - rustc_query_impl[f27b006aa91c0ba0]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  60:     0x7f35ceba6036 - rustc_middle[f32ad3853e76b525]::query::plumbing::query_get_at::<rustc_query_system[e2bc6f1fc30f6df]::query::caches::DefaultCache<rustc_middle[f32ad3853e76b525]::ty::ParamEnvAnd<rustc_middle[f32ad3853e76b525]::mir::interpret::GlobalId>, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 24usize]>>>
  61:     0x7f35ceb80fe1 - rustc_const_eval[b66d8613139a267c]::const_eval::valtrees::eval_to_valtree
  62:     0x7f35ceb80f62 - <rustc_const_eval[b66d8613139a267c]::provide::{closure#0} as core[620758cd80b91dd0]::ops::function::FnOnce<(rustc_middle[f32ad3853e76b525]::ty::context::TyCtxt, rustc_middle[f32ad3853e76b525]::ty::ParamEnvAnd<rustc_middle[f32ad3853e76b525]::mir::interpret::GlobalId>)>>::call_once
  63:     0x7f35ceb80f36 - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 24usize]>>
  64:     0x7f35ceb80eef - <rustc_query_impl[f27b006aa91c0ba0]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[620758cd80b91dd0]::ops::function::FnOnce<(rustc_middle[f32ad3853e76b525]::ty::context::TyCtxt, rustc_middle[f32ad3853e76b525]::ty::ParamEnvAnd<rustc_middle[f32ad3853e76b525]::mir::interpret::GlobalId>)>>::call_once
  65:     0x7f35ceba69b1 - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::DefaultCache<rustc_middle[f32ad3853e76b525]::ty::ParamEnvAnd<rustc_middle[f32ad3853e76b525]::mir::interpret::GlobalId>, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  66:     0x7f35ce3ebb2c - rustc_query_impl[f27b006aa91c0ba0]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
  67:     0x7f35ce3ea5ff - rustc_middle[f32ad3853e76b525]::query::plumbing::query_get_at::<rustc_query_system[e2bc6f1fc30f6df]::query::caches::DefaultCache<rustc_middle[f32ad3853e76b525]::ty::ParamEnvAnd<rustc_middle[f32ad3853e76b525]::mir::interpret::GlobalId>, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 24usize]>>>
  68:     0x7f35ce7fea82 - <rustc_middle[f32ad3853e76b525]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
  69:     0x7f35ce7fe1eb - <rustc_middle[f32ad3853e76b525]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  70:     0x7f35ce7fdfa0 - <rustc_middle[f32ad3853e76b525]::ty::consts::Const>::eval
  71:     0x7f35ce2142c1 - <rustc_trait_selection[d9dc339916816dbb]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[6eae33a59f3ded5]::fold::TypeFolder<rustc_middle[f32ad3853e76b525]::ty::context::TyCtxt>>::fold_const
  72:     0x7f35ce761a28 - <rustc_middle[f32ad3853e76b525]::ty::Ty as rustc_type_ir[6eae33a59f3ded5]::fold::TypeSuperFoldable<rustc_middle[f32ad3853e76b525]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_trait_selection[d9dc339916816dbb]::traits::normalize::AssocTypeNormalizer>
  73:     0x7f35ce05f675 - <rustc_hir_typeck[312bf9d4ee85e4af]::fn_ctxt::FnCtxt>::normalize::<rustc_middle[f32ad3853e76b525]::ty::Ty>
  74:     0x7f35ce8ef57e - <dyn rustc_hir_analysis[3e5cabd178036183]::hir_ty_lowering::HirTyLowerer>::lower_ty_common
  75:     0x7f35cb4ae618 - <rustc_hir_typeck[312bf9d4ee85e4af]::gather_locals::GatherLocalsVisitor as rustc_hir[983043ae5138aa3e]::intravisit::Visitor>::visit_expr
  76:     0x7f35ce220e9e - rustc_hir_typeck[312bf9d4ee85e4af]::check::check_fn
  77:     0x7f35ce217b96 - rustc_hir_typeck[312bf9d4ee85e4af]::typeck
  78:     0x7f35ce217557 - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>
  79:     0x7f35ce2044f1 - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::VecCache<rustc_span[abf425ab4de01d9]::def_id::LocalDefId, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  80:     0x7f35ce20094c - rustc_query_impl[f27b006aa91c0ba0]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  81:     0x7f35ce20052b - <rustc_middle[f32ad3853e76b525]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[3e5cabd178036183]::check_crate::{closure#4}>::{closure#0}
  82:     0x7f35ce1ff1e1 - rustc_hir_analysis[3e5cabd178036183]::check_crate
  83:     0x7f35ce4ce36a - rustc_interface[bc155c77a5e962ed]::passes::analysis
  84:     0x7f35ce4cded3 - rustc_query_impl[f27b006aa91c0ba0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f27b006aa91c0ba0]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 1usize]>>
  85:     0x7f35cee12de5 - rustc_query_system[e2bc6f1fc30f6df]::query::plumbing::try_execute_query::<rustc_query_impl[f27b006aa91c0ba0]::DynamicConfig<rustc_query_system[e2bc6f1fc30f6df]::query::caches::SingleCache<rustc_middle[f32ad3853e76b525]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[f27b006aa91c0ba0]::plumbing::QueryCtxt, false>
  86:     0x7f35cee12b49 - rustc_query_impl[f27b006aa91c0ba0]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  87:     0x7f35ceccb1d3 - rustc_interface[bc155c77a5e962ed]::interface::run_compiler::<core[620758cd80b91dd0]::result::Result<(), rustc_span[abf425ab4de01d9]::ErrorGuaranteed>, rustc_driver_impl[4156c2df247de3fc]::run_compiler::{closure#0}>::{closure#0}
  88:     0x7f35ced5ac19 - std[cd169797441e4304]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[bc155c77a5e962ed]::util::run_in_thread_with_globals<rustc_interface[bc155c77a5e962ed]::util::run_in_thread_pool_with_globals<rustc_interface[bc155c77a5e962ed]::interface::run_compiler<core[620758cd80b91dd0]::result::Result<(), rustc_span[abf425ab4de01d9]::ErrorGuaranteed>, rustc_driver_impl[4156c2df247de3fc]::run_compiler::{closure#0}>::{closure#0}, core[620758cd80b91dd0]::result::Result<(), rustc_span[abf425ab4de01d9]::ErrorGuaranteed>>::{closure#0}, core[620758cd80b91dd0]::result::Result<(), rustc_span[abf425ab4de01d9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[620758cd80b91dd0]::result::Result<(), rustc_span[abf425ab4de01d9]::ErrorGuaranteed>>
  89:     0x7f35ced5aa27 - <<std[cd169797441e4304]::thread::Builder>::spawn_unchecked_<rustc_interface[bc155c77a5e962ed]::util::run_in_thread_with_globals<rustc_interface[bc155c77a5e962ed]::util::run_in_thread_pool_with_globals<rustc_interface[bc155c77a5e962ed]::interface::run_compiler<core[620758cd80b91dd0]::result::Result<(), rustc_span[abf425ab4de01d9]::ErrorGuaranteed>, rustc_driver_impl[4156c2df247de3fc]::run_compiler::{closure#0}>::{closure#0}, core[620758cd80b91dd0]::result::Result<(), rustc_span[abf425ab4de01d9]::ErrorGuaranteed>>::{closure#0}, core[620758cd80b91dd0]::result::Result<(), rustc_span[abf425ab4de01d9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[620758cd80b91dd0]::result::Result<(), rustc_span[abf425ab4de01d9]::ErrorGuaranteed>>::{closure#1} as core[620758cd80b91dd0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  90:     0x7f35d03a93fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd0a22ba669218411
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/alloc/src/boxed.rs:2018:9
  91:     0x7f35d03a93fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcc773386fb5423d0
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/alloc/src/boxed.rs:2018:9
  92:     0x7f35d03a93fb - std::sys::pal::unix::thread::Thread::new::thread_start::hecd789c0696ca351
                               at /rustc/a77322c16f188402fa22a5e87100acce42433cbc/library/std/src/sys/pal/unix/thread.rs:108:17
  93:     0x7f35d014755a - <unknown>
  94:     0x7f35d01c4a3c - <unknown>
  95:                0x0 - <unknown>

note: it seems that this compiler `1.79.0-nightly (a77322c16 2024-04-02)` is outdated, a newer nightly should have been released in the mean time
  |
  = note: please consider running `rustup update nightly` to update the nightly channel and check if this problem still persists
  = note: if the problem still persists, 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.79.0-nightly (a77322c16 2024-04-02) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main::{constant#0}`
#1 [check_match] match-checking `main::{constant#0}`
#2 [mir_built] building MIR for `main::{constant#0}`
#3 [mir_const_qualif] const checking `main::{constant#0}`
#4 [mir_promoted] promoting constants in MIR for `main::{constant#0}`
#5 [mir_borrowck] borrow-checking `main::{constant#0}`
#6 [mir_drops_elaborated_and_const_checked] elaborating drops for `main::{constant#0}`
#7 [mir_for_ctfe] caching mir of `main::{constant#0}` for CTFE
#8 [eval_to_allocation_raw] const-evaluating + checking `main::{constant#0}`
#9 [eval_to_valtree] evaluating type-level constant
#10 [typeck] type-checking `main`
#11 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error


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

bisects to #121208 cc @nnethercote

@jieyouxu jieyouxu added A-hir Area: The high-level intermediate representation (HIR) S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 4, 2024
@compiler-errors compiler-errors self-assigned this Apr 6, 2024
@compiler-errors
Copy link
Member

Oh no.... we don't check closure args for wf :(

bors added a commit to rust-lang-ci/rust that referenced this issue Apr 6, 2024
Enforce closure args + return type are WF

I found this out when investigating rust-lang#123461 (comment). Turns out we don't register WF obligations for closure args and return types, leading to the ICE.

I think this is a useful thing to check for, but I'd like to check what the fallout is.

Worst case, I think we should enforce this across an edition boundary (and possibly eventually migrate this for all editions).
@nnethercote
Copy link
Contributor

I think this is case where #121208 exposed a latent bug? Which is a good thing.

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 18, 2024
@bors bors closed this as completed in 9e6c4fd Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-hir Area: The high-level intermediate representation (HIR) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
5 participants