rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.89k stars 12.78k forks source link

ICE: Layout::compute: unexpected type `_` #130104

Open matthiaskrgr opened 2 months ago

matthiaskrgr commented 2 months ago

Code

fn main() {
    let non_secure_function =
        core::mem::transmute::<fn() -> _, extern "C-cmse-nonsecure-call" fn() -> _>;
}

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (12b26c13f 2024-09-07)
binary: rustc
commit-hash: 12b26c13fba25c9e1bc2fdf05f3c2dbb851c83de
commit-date: 2024-09-07
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Error output

<output>
Backtrace

``` error[E0658]: C-cmse-nonsecure-call ABI is experimental and subject to change --> a.rs:3:50 | 3 | core::mem::transmute:: _, extern "C-cmse-nonsecure-call" fn() -> _>; | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #81391 for more information = help: add `#![feature(abi_c_cmse_nonsecure_call)]` to the crate attributes to enable = note: this compiler was built on 2024-09-07; consider upgrading it if it is out of date error: internal compiler error: compiler/rustc_ty_utils/src/layout.rs:678:13: Layout::compute: unexpected type `_` thread 'rustc' panicked at compiler/rustc_ty_utils/src/layout.rs:678:13: Box stack backtrace: 0: 0x794b2586ed7a - ::fmt::had40ff6b0d363d8c 1: 0x794b260038d7 - core::fmt::write::h8896cd9c17192606 2: 0x794b26fd6991 - std::io::Write::write_fmt::h2513a98e60324138 3: 0x794b2586ebd2 - std::sys::backtrace::BacktraceLock::print::h97ff941b8ca3ca17 4: 0x794b258710f1 - std::panicking::default_hook::{{closure}}::h1240f9059a722e94 5: 0x794b25870f24 - std::panicking::default_hook::hef1ed95231316e5f 6: 0x794b24987a9f - std[484d8c24ec532d56]::panicking::update_hook::>::{closure#0} 7: 0x794b25871818 - std::panicking::rust_panic_with_hook::ha3e00c002dd0b838 8: 0x794b249c1761 - std[484d8c24ec532d56]::panicking::begin_panic::::{closure#0} 9: 0x794b249b4ef6 - std[484d8c24ec532d56]::sys::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 10: 0x794b249b03e9 - std[484d8c24ec532d56]::panicking::begin_panic:: 11: 0x794b249caa81 - ::emit_producing_guarantee 12: 0x794b24fe2884 - rustc_middle[da941fcb4ea689b5]::util::bug::opt_span_bug_fmt::::{closure#0} 13: 0x794b24fc8b1a - rustc_middle[da941fcb4ea689b5]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 14: 0x794b24fc89ab - rustc_middle[da941fcb4ea689b5]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 15: 0x794b2257a260 - rustc_middle[da941fcb4ea689b5]::util::bug::bug_fmt 16: 0x794b269d9b3f - rustc_ty_utils[ce99518b9646809a]::layout::layout_of_uncached 17: 0x794b269d3fc6 - rustc_ty_utils[ce99518b9646809a]::layout::layout_of 18: 0x794b269d3f51 - rustc_query_impl[a6b34b6c656310e8]::plumbing::__rust_begin_short_backtrace::> 19: 0x794b269d31d3 - rustc_query_system[43367dc2cdf302c7]::query::plumbing::try_execute_query::, rustc_middle[da941fcb4ea689b5]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[a6b34b6c656310e8]::plumbing::QueryCtxt, false> 20: 0x794b269d2e6d - rustc_query_impl[a6b34b6c656310e8]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace 21: 0x794b26eed09c - rustc_middle[da941fcb4ea689b5]::query::plumbing::query_get_at::, rustc_middle[da941fcb4ea689b5]::query::erase::Erased<[u8; 16usize]>>> 22: 0x794b268ab6d8 - ::lower_fn_ty 23: 0x794b268b174b - ::lower_ty 24: 0x794b268bcaad - <::instantiate_value_path::CtorGenericArgsCtxt as rustc_hir_analysis[6ffe0ea406cdfc5e]::hir_ty_lowering::GenericArgsLowerer>::provided_kind 25: 0x794b26a5e248 - ::instantiate_value_path 26: 0x794b26a51d26 - ::check_expr_path 27: 0x794b26c9d218 - ::check_expr_with_expectation_and_args 28: 0x794b26c9c084 - ::check_decl 29: 0x794b26c992df - ::check_block_with_expected 30: 0x794b26c9f853 - ::check_expr_with_expectation_and_args 31: 0x794b2611d5f9 - rustc_hir_typeck[e4ce35102d8b94c1]::check::check_fn 32: 0x794b26864032 - rustc_hir_typeck[e4ce35102d8b94c1]::typeck 33: 0x794b26863a65 - rustc_query_impl[a6b34b6c656310e8]::plumbing::__rust_begin_short_backtrace::> 34: 0x794b261ba53a - rustc_query_system[43367dc2cdf302c7]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[a6b34b6c656310e8]::plumbing::QueryCtxt, false> 35: 0x794b261b910d - rustc_query_impl[a6b34b6c656310e8]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace 36: 0x794b261b8d87 - ::par_body_owners::::{closure#0} 37: 0x794b261b6c20 - rustc_hir_analysis[6ffe0ea406cdfc5e]::check_crate 38: 0x794b26779cff - rustc_interface[d79dc78584d485d1]::passes::run_required_analyses 39: 0x794b26dcf19e - rustc_interface[d79dc78584d485d1]::passes::analysis 40: 0x794b26dcf171 - rustc_query_impl[a6b34b6c656310e8]::plumbing::__rust_begin_short_backtrace::> 41: 0x794b26f9726e - rustc_query_system[43367dc2cdf302c7]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[a6b34b6c656310e8]::plumbing::QueryCtxt, false> 42: 0x794b26f96fcf - rustc_query_impl[a6b34b6c656310e8]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 43: 0x794b26dc1a3c - rustc_interface[d79dc78584d485d1]::interface::run_compiler::, rustc_driver_impl[be7972101cd0935a]::run_compiler::{closure#0}>::{closure#1} 44: 0x794b26e93d90 - std[484d8c24ec532d56]::sys::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[be7972101cd0935a]::run_compiler::{closure#0}>::{closure#1}, core[5eff1680495eda70]::result::Result<(), rustc_span[198bb2277a7734d7]::ErrorGuaranteed>>::{closure#0}, core[5eff1680495eda70]::result::Result<(), rustc_span[198bb2277a7734d7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5eff1680495eda70]::result::Result<(), rustc_span[198bb2277a7734d7]::ErrorGuaranteed>> 45: 0x794b26e943fa - <::spawn_unchecked_, rustc_driver_impl[be7972101cd0935a]::run_compiler::{closure#0}>::{closure#1}, core[5eff1680495eda70]::result::Result<(), rustc_span[198bb2277a7734d7]::ErrorGuaranteed>>::{closure#0}, core[5eff1680495eda70]::result::Result<(), rustc_span[198bb2277a7734d7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5eff1680495eda70]::result::Result<(), rustc_span[198bb2277a7734d7]::ErrorGuaranteed>>::{closure#1} as core[5eff1680495eda70]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 46: 0x794b26e947af - std::sys::pal::unix::thread::Thread::new::thread_start::h17c8afa67f401ea5 47: 0x794b2851839d - 48: 0x794b2859d49c - 49: 0x0 - 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: please attach the file at `/tmp/im/2/rustc-ice-2024-09-08T16_22_30-798743.txt` to your bug report query stack during panic: panicked at /rustc/12b26c13fba25c9e1bc2fdf05f3c2dbb851c83de/compiler/rustc_type_ir/src/ty_kind.rs:797:17: thread panicked while processing panic. aborting. [1] 798743 IOT instruction rustc a.rs ```

matthiaskrgr commented 2 months ago

this one also bisects to #127814 cc @folkertdev

apiraino commented 2 months ago

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium