rust icon indicating copy to clipboard operation
rust copied to clipboard

ICE: compiler/rustc_middle/src/ty/layout.rs:3199:21: argument to function with "rust-call" ABI is not a tuple

Open matthiaskrgr opened this issue 2 years ago • 4 comments

Code

code is from glacier fixed/69487-1.rs

#![feature(const_trait_impl)]
#![feature(fn_traits)]
#![feature(unboxed_closures)]

struct Closure;

impl const FnOnce<&usize> for Closure {
    type Output = usize;

    extern "rust-call" fn call_once(self, arg: &usize) -> Self::Output {
        *arg
    }
}

enum Bug<T = [(); Closure.call_once(&0) ]> {
    V(T),
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.64.0-nightly (4d6d601c8 2022-07-26)
binary: rustc
commit-hash: 4d6d601c8a83284d6b23c253a3e2a060fd197316
commit-date: 2022-07-26
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6

It's a bit weird, since this is in glacier/fixed, apparently this one crashed, then it was fixed and then it regressed again..? I ran cargo-bisect and it said

********************************************************************************
Regression in nightly-2021-12-25
********************************************************************************

found 8 bors merge commits in the specified range
  commit[0] 2021-12-23UTC: Auto merge of #92232 - matthiaskrgr:rollup-eqdac7z, r=matthiaskrgr
  commit[1] 2021-12-23UTC: Auto merge of #92222 - nnethercote:rm-global_allocator-rustc-rustdoc, r=alexcrichton
  commit[2] 2021-12-24UTC: Auto merge of #92220 - nnethercote:RawVec-dont-recompute-capacity, r=joshtriplett
  commit[3] 2021-12-24UTC: Auto merge of #91342 - RalfJung:fn-abi, r=eddyb,oli-obk
  commit[4] 2021-12-24UTC: Auto merge of #92226 - woppopo:const_black_box, r=joshtriplett
  commit[5] 2021-12-24UTC: Auto merge of #92253 - RalfJung:miri, r=RalfJung
  commit[6] 2021-12-24UTC: Auto merge of #92156 - petrochenkov:ctorkind, r=davidtwco
  commit[7] 2021-12-24UTC: Auto merge of #92135 - AngelicosPhosphoros:typeid_inline_74362, r=dtolnay
ERROR: no CI builds available between c09a9529c51cde41c1101e56049d418edb07bf71 and 475b00aa4037461b506539a06d15ca6091b461a7 within last 167 days

Searching for the code in the bugtracker though points to https://github.com/rust-lang/rust/issues/69487 and https://github.com/rust-lang/rust/issues/88433 which have completely different backtraces :/

Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/layout.rs:3199:21: argument to function with "rust-call" ABI is not a tuple

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/compiler/rustc_errors/src/lib.rs:1392:9
stack backtrace:
   0:     0x7f6283515190 - std::backtrace_rs::backtrace::libunwind::trace::hc5f0e1506f4edb39
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f6283515190 - std::backtrace_rs::backtrace::trace_unsynchronized::h53b1c5dc3c06560b
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6283515190 - std::sys_common::backtrace::_print_fmt::h1a7d5f48906eae70
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f6283515190 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hed9a08d0af811fa5
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f628357064c - core::fmt::write::h574d7e8060e08389
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/core/src/fmt/mod.rs:1198:17
   5:     0x7f62835061c5 - std::io::Write::write_fmt::h3266c77374172c32
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/io/mod.rs:1672:15
   6:     0x7f6283517e61 - std::sys_common::backtrace::_print::h745319fa404abc88
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f6283517e61 - std::sys_common::backtrace::print::h42f1b482778349d6
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f6283517e61 - std::panicking::default_hook::{{closure}}::hf42ee92d109b18cd
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/panicking.rs:295:22
   9:     0x7f6283517b33 - std::panicking::default_hook::heb8c1646fafa37cf
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/panicking.rs:314:9
  10:     0x7f6285ce7c44 - <rustc_driver[a0ade260a6e789b1]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[a599283b7c69020c]::ops::function::FnOnce<(&core[a599283b7c69020c]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f6283518696 - std::panicking::rust_panic_with_hook::h92fcad6ddbd25f63
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/panicking.rs:702:17
  12:     0x7f6286ba6ee1 - std[a5d371daafdd0081]::panicking::begin_panic::<rustc_errors[bf0ec959d267706f]::ExplicitBug>::{closure#0}
  13:     0x7f6286ba5886 - std[a5d371daafdd0081]::sys_common::backtrace::__rust_end_short_backtrace::<std[a5d371daafdd0081]::panicking::begin_panic<rustc_errors[bf0ec959d267706f]::ExplicitBug>::{closure#0}, !>
  14:     0x7f6286bd4726 - std[a5d371daafdd0081]::panicking::begin_panic::<rustc_errors[bf0ec959d267706f]::ExplicitBug>
  15:     0x7f6286ba5876 - std[a5d371daafdd0081]::panic::panic_any::<rustc_errors[bf0ec959d267706f]::ExplicitBug>
  16:     0x7f6286ba32d5 - <rustc_errors[bf0ec959d267706f]::HandlerInner>::bug::<&alloc[43aff5f2a0bdecff]::string::String>
  17:     0x7f6286ba3030 - <rustc_errors[bf0ec959d267706f]::Handler>::bug::<&alloc[43aff5f2a0bdecff]::string::String>
  18:     0x7f6286c45abd - rustc_middle[c06c896bc6ed41f6]::ty::context::tls::with_context_opt::<rustc_middle[c06c896bc6ed41f6]::ty::context::tls::with_opt<rustc_middle[c06c896bc6ed41f6]::util::bug::opt_span_bug_fmt<rustc_span[90105904d27db040]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  19:     0x7f6286c4ae36 - rustc_middle[c06c896bc6ed41f6]::util::bug::opt_span_bug_fmt::<rustc_span[90105904d27db040]::span_encoding::Span>
  20:     0x7f62847f2a63 - rustc_middle[c06c896bc6ed41f6]::util::bug::bug_fmt
  21:     0x7f62852198c1 - <rustc_middle[c06c896bc6ed41f6]::ty::layout::LayoutCx<rustc_middle[c06c896bc6ed41f6]::ty::context::TyCtxt>>::fn_abi_new_uncached
  22:     0x7f6285217e48 - rustc_middle[c06c896bc6ed41f6]::ty::layout::fn_abi_of_instance
  23:     0x7f628524aed2 - rustc_query_system[a458740b1a6fe87d]::query::plumbing::get_query::<rustc_query_impl[be804afc13dcb226]::queries::fn_abi_of_instance, rustc_query_impl[be804afc13dcb226]::plumbing::QueryCtxt>
  24:     0x7f628524a94e - <rustc_query_impl[be804afc13dcb226]::Queries as rustc_middle[c06c896bc6ed41f6]::ty::query::QueryEngine>::fn_abi_of_instance
  25:     0x7f6284f178b1 - <rustc_const_eval[e82c253dd65649e6]::interpret::eval_context::InterpCx<rustc_const_eval[e82c253dd65649e6]::const_eval::machine::CompileTimeInterpreter>>::run
  26:     0x7f6284ec603d - rustc_const_eval[e82c253dd65649e6]::const_eval::eval_queries::eval_to_allocation_raw_provider
  27:     0x7f62855d8b5f - rustc_query_system[a458740b1a6fe87d]::query::plumbing::get_query::<rustc_query_impl[be804afc13dcb226]::queries::eval_to_allocation_raw, rustc_query_impl[be804afc13dcb226]::plumbing::QueryCtxt>
  28:     0x7f62855d8725 - <rustc_query_impl[be804afc13dcb226]::Queries as rustc_middle[c06c896bc6ed41f6]::ty::query::QueryEngine>::eval_to_allocation_raw
  29:     0x7f6284ec66f5 - rustc_const_eval[e82c253dd65649e6]::const_eval::eval_queries::eval_to_allocation_raw_provider
  30:     0x7f62855d8b5f - rustc_query_system[a458740b1a6fe87d]::query::plumbing::get_query::<rustc_query_impl[be804afc13dcb226]::queries::eval_to_allocation_raw, rustc_query_impl[be804afc13dcb226]::plumbing::QueryCtxt>
  31:     0x7f62855d8725 - <rustc_query_impl[be804afc13dcb226]::Queries as rustc_middle[c06c896bc6ed41f6]::ty::query::QueryEngine>::eval_to_allocation_raw
  32:     0x7f628592588a - rustc_const_eval[e82c253dd65649e6]::const_eval::eval_to_valtree
  33:     0x7f6285925740 - <rustc_const_eval[e82c253dd65649e6]::provide::{closure#0} as core[a599283b7c69020c]::ops::function::FnOnce<(rustc_middle[c06c896bc6ed41f6]::ty::context::TyCtxt, rustc_middle[c06c896bc6ed41f6]::ty::ParamEnvAnd<rustc_middle[c06c896bc6ed41f6]::mir::interpret::GlobalId>)>>::call_once
  34:     0x7f628592a9f1 - rustc_query_system[a458740b1a6fe87d]::query::plumbing::get_query::<rustc_query_impl[be804afc13dcb226]::queries::eval_to_valtree, rustc_query_impl[be804afc13dcb226]::plumbing::QueryCtxt>
  35:     0x7f628592a5b5 - <rustc_query_impl[be804afc13dcb226]::Queries as rustc_middle[c06c896bc6ed41f6]::ty::query::QueryEngine>::eval_to_valtree
  36:     0x7f6284a6fdda - <rustc_middle[c06c896bc6ed41f6]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
  37:     0x7f6284a6ecb3 - <rustc_middle[c06c896bc6ed41f6]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  38:     0x7f6284a6e794 - <rustc_trait_selection[a904ffdf26712209]::traits::project::AssocTypeNormalizer as rustc_middle[c06c896bc6ed41f6]::ty::fold::TypeFolder>::fold_const
  39:     0x7f6284a5a737 - <rustc_trait_selection[a904ffdf26712209]::traits::project::AssocTypeNormalizer as rustc_middle[c06c896bc6ed41f6]::ty::fold::TypeFolder>::fold_ty
  40:     0x7f62856191de - <rustc_middle[c06c896bc6ed41f6]::ty::PredicateKind as rustc_middle[c06c896bc6ed41f6]::ty::fold::TypeFoldable>::try_fold_with::<rustc_trait_selection[a904ffdf26712209]::traits::project::AssocTypeNormalizer>
  41:     0x7f6285618f10 - <rustc_trait_selection[a904ffdf26712209]::traits::project::AssocTypeNormalizer as rustc_middle[c06c896bc6ed41f6]::ty::fold::FallibleTypeFolder>::try_fold_predicate
  42:     0x7f628561898e - rustc_trait_selection[a904ffdf26712209]::traits::project::normalize::<rustc_middle[c06c896bc6ed41f6]::ty::Predicate>
  43:     0x7f628505fe90 - <rustc_trait_selection[a904ffdf26712209]::traits::engine::ObligationCtxt>::normalize::<rustc_middle[c06c896bc6ed41f6]::ty::Predicate>
  44:     0x7f628506031b - <&mut rustc_typeck[ecb2f10f2e9a7a04]::check::wfcheck::check_where_clauses::{closure#3} as core[a599283b7c69020c]::ops::function::FnOnce<((rustc_middle[c06c896bc6ed41f6]::ty::Predicate, rustc_span[90105904d27db040]::span_encoding::Span),)>>::call_once
  45:     0x7f628505232e - <alloc[43aff5f2a0bdecff]::vec::Vec<rustc_infer[6faa4944682abd6b]::traits::Obligation<rustc_middle[c06c896bc6ed41f6]::ty::Predicate>> as alloc[43aff5f2a0bdecff]::vec::spec_from_iter::SpecFromIter<rustc_infer[6faa4944682abd6b]::traits::Obligation<rustc_middle[c06c896bc6ed41f6]::ty::Predicate>, core[a599283b7c69020c]::iter::adapters::chain::Chain<core[a599283b7c69020c]::iter::adapters::flatten::FlatMap<core[a599283b7c69020c]::iter::adapters::zip::Zip<core[a599283b7c69020c]::slice::iter::Iter<rustc_middle[c06c896bc6ed41f6]::ty::Predicate>, core[a599283b7c69020c]::slice::iter::Iter<rustc_span[90105904d27db040]::span_encoding::Span>>, alloc[43aff5f2a0bdecff]::vec::Vec<rustc_infer[6faa4944682abd6b]::traits::Obligation<rustc_middle[c06c896bc6ed41f6]::ty::Predicate>>, rustc_typeck[ecb2f10f2e9a7a04]::check::wfcheck::check_where_clauses::{closure#4}>, core[a599283b7c69020c]::iter::adapters::map::Map<core[a599283b7c69020c]::iter::adapters::flatten::FlatMap<core[a599283b7c69020c]::slice::iter::Iter<(rustc_middle[c06c896bc6ed41f6]::ty::Predicate, rustc_span[90105904d27db040]::span_encoding::Span)>, core[a599283b7c69020c]::option::Option<(rustc_middle[c06c896bc6ed41f6]::ty::Predicate, rustc_span[90105904d27db040]::span_encoding::Span)>, rustc_typeck[ecb2f10f2e9a7a04]::check::wfcheck::check_where_clauses::{closure#2}>, rustc_typeck[ecb2f10f2e9a7a04]::check::wfcheck::check_where_clauses::{closure#3}>>>>::from_iter
  46:     0x7f6285050436 - rustc_typeck[ecb2f10f2e9a7a04]::check::wfcheck::check_where_clauses
  47:     0x7f6285038179 - rustc_typeck[ecb2f10f2e9a7a04]::check::wfcheck::check_well_formed
  48:     0x7f6284fe698b - rustc_query_system[a458740b1a6fe87d]::query::plumbing::try_execute_query::<rustc_query_impl[be804afc13dcb226]::plumbing::QueryCtxt, rustc_query_system[a458740b1a6fe87d]::query::caches::DefaultCache<rustc_span[90105904d27db040]::def_id::LocalDefId, ()>>
  49:     0x7f628475e4f5 - <rustc_query_impl[be804afc13dcb226]::Queries as rustc_middle[c06c896bc6ed41f6]::ty::query::QueryEngine>::check_well_formed
  50:     0x7f62857a730b - rustc_data_structures[fbd16ab03047d4e1]::sync::par_for_each_in::<&[rustc_hir[3101c63fda7ef935]::hir::ItemId], <rustc_middle[c06c896bc6ed41f6]::hir::ModuleItems>::par_items<rustc_typeck[ecb2f10f2e9a7a04]::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
  51:     0x7f6285b673e9 - rustc_typeck[ecb2f10f2e9a7a04]::check::wfcheck::check_mod_type_wf
  52:     0x7f6284fe698b - rustc_query_system[a458740b1a6fe87d]::query::plumbing::try_execute_query::<rustc_query_impl[be804afc13dcb226]::plumbing::QueryCtxt, rustc_query_system[a458740b1a6fe87d]::query::caches::DefaultCache<rustc_span[90105904d27db040]::def_id::LocalDefId, ()>>
  53:     0x7f6285756563 - rustc_query_system[a458740b1a6fe87d]::query::plumbing::get_query::<rustc_query_impl[be804afc13dcb226]::queries::check_mod_type_wf, rustc_query_impl[be804afc13dcb226]::plumbing::QueryCtxt>
  54:     0x7f62856daa9f - <rustc_middle[c06c896bc6ed41f6]::hir::map::Map>::for_each_module::<rustc_typeck[ecb2f10f2e9a7a04]::check_crate::{closure#5}::{closure#0}::{closure#0}>
  55:     0x7f62856d92e2 - <rustc_session[7e34ebf252ff7713]::session::Session>::track_errors::<rustc_typeck[ecb2f10f2e9a7a04]::check_crate::{closure#5}, ()>
  56:     0x7f62856d8ea0 - rustc_typeck[ecb2f10f2e9a7a04]::check_crate
  57:     0x7f62856d84c7 - rustc_interface[12cd15037279811a]::passes::analysis
  58:     0x7f6285aa0575 - rustc_query_system[a458740b1a6fe87d]::query::plumbing::try_execute_query::<rustc_query_impl[be804afc13dcb226]::plumbing::QueryCtxt, rustc_query_system[a458740b1a6fe87d]::query::caches::DefaultCache<(), core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>>>
  59:     0x7f6285aa02fe - rustc_query_system[a458740b1a6fe87d]::query::plumbing::get_query::<rustc_query_impl[be804afc13dcb226]::queries::analysis, rustc_query_impl[be804afc13dcb226]::plumbing::QueryCtxt>
  60:     0x7f6285468ffe - <rustc_interface[12cd15037279811a]::passes::QueryContext>::enter::<rustc_driver[a0ade260a6e789b1]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>>
  61:     0x7f628546349e - <rustc_interface[12cd15037279811a]::interface::Compiler>::enter::<rustc_driver[a0ade260a6e789b1]::run_compiler::{closure#1}::{closure#2}, core[a599283b7c69020c]::result::Result<core[a599283b7c69020c]::option::Option<rustc_interface[12cd15037279811a]::queries::Linker>, rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>>
  62:     0x7f628545edea - rustc_span[90105904d27db040]::with_source_map::<core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>, rustc_interface[12cd15037279811a]::interface::create_compiler_and_run<core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>, rustc_driver[a0ade260a6e789b1]::run_compiler::{closure#1}>::{closure#1}>
  63:     0x7f628545e840 - rustc_interface[12cd15037279811a]::interface::create_compiler_and_run::<core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>, rustc_driver[a0ade260a6e789b1]::run_compiler::{closure#1}>
  64:     0x7f628545caf2 - <scoped_tls[5363f42907f48936]::ScopedKey<rustc_span[90105904d27db040]::SessionGlobals>>::set::<rustc_interface[12cd15037279811a]::interface::run_compiler<core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>, rustc_driver[a0ade260a6e789b1]::run_compiler::{closure#1}>::{closure#0}, core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>>
  65:     0x7f628545c7df - std[a5d371daafdd0081]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[12cd15037279811a]::util::run_in_thread_pool_with_globals<rustc_interface[12cd15037279811a]::interface::run_compiler<core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>, rustc_driver[a0ade260a6e789b1]::run_compiler::{closure#1}>::{closure#0}, core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>>::{closure#0}, core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>>
  66:     0x7f6285b1fb99 - <<std[a5d371daafdd0081]::thread::Builder>::spawn_unchecked_<rustc_interface[12cd15037279811a]::util::run_in_thread_pool_with_globals<rustc_interface[12cd15037279811a]::interface::run_compiler<core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>, rustc_driver[a0ade260a6e789b1]::run_compiler::{closure#1}>::{closure#0}, core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>>::{closure#0}, core[a599283b7c69020c]::result::Result<(), rustc_errors[bf0ec959d267706f]::ErrorGuaranteed>>::{closure#1} as core[a599283b7c69020c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  67:     0x7f6283522133 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd902820237ccecb5
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/alloc/src/boxed.rs:1935:9
  68:     0x7f6283522133 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3e95e0b5b37527e9
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/alloc/src/boxed.rs:1935:9
  69:     0x7f6283522133 - std::sys::unix::thread::Thread::new::thread_start::h2c734a2b9024b980
                               at /rustc/4d6d601c8a83284d6b23c253a3e2a060fd197316/library/std/src/sys/unix/thread.rs:108:17
  70:     0x7f628325a54d - <unknown>
  71:     0x7f62832df874 - clone
  72:                0x0 - <unknown>

note: 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.64.0-nightly (4d6d601c8 2022-07-26) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [fn_abi_of_instance] computing call ABI of `<impl at /home/matthias/vcs/github/glacier/fixed/69487-1.rs:7:1: 7:38>::call_once`
#1 [eval_to_allocation_raw] const-evaluating + checking `Bug::{constant#0}`
#2 [eval_to_allocation_raw] const-evaluating + checking `Bug::{constant#0}`
#3 [eval_to_valtree] evaluating type-level constant
#4 [check_well_formed] checking that `Bug` is well-formed
#5 [check_mod_type_wf] checking that types are well-formed in top-level module
#6 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

matthiaskrgr avatar Jul 27 '22 19:07 matthiaskrgr

The code from https://github.com/rust-lang/rust/issues/66696 also crashes again

// This is ICE deliberately.

#![feature(unboxed_closures)]
fn main() {
    unsafe { std::mem::transmute::<usize, extern "rust-call" fn()>(5); }
}

matthiaskrgr avatar Jul 27 '22 20:07 matthiaskrgr

Typeck should probably just check that functions with the rust-call abi have two arguments. One of arbitrary type and a second of a tuple type. That would also fix https://github.com/bjorn3/rustc_codegen_cranelift/issues/1236.

bjorn3 avatar Jul 28 '22 16:07 bjorn3

@bjorn3 I don't think this can exist in typeck, at least not without extra type information encoded into the program, since we can't determine if a ty::Param is tupled or not.

compiler-errors avatar Jul 28 '22 20:07 compiler-errors

Fixed by #99943

compiler-errors avatar Aug 05 '22 23:08 compiler-errors