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: Layout::compute: unexpected type _ #130104

Open
matthiaskrgr opened this issue Sep 8, 2024 · 2 comments
Open

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

matthiaskrgr opened this issue Sep 8, 2024 · 2 comments
Labels
A-layout Area: Memory layout of types C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

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::<fn() -> _, extern "C-cmse-nonsecure-call" fn() -> _>;
  |                                                  ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #81391 <https://github.com/rust-lang/rust/issues/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<dyn Any>
stack backtrace:
   0:     0x794b2586ed7a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::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::<alloc[eb1bfcc000f6131b]::boxed::Box<rustc_driver_impl[be7972101cd0935a]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x794b25871818 - std::panicking::rust_panic_with_hook::ha3e00c002dd0b838
   8:     0x794b249c1761 - std[484d8c24ec532d56]::panicking::begin_panic::<rustc_errors[35018a33f26c22cc]::ExplicitBug>::{closure#0}
   9:     0x794b249b4ef6 - std[484d8c24ec532d56]::sys::backtrace::__rust_end_short_backtrace::<std[484d8c24ec532d56]::panicking::begin_panic<rustc_errors[35018a33f26c22cc]::ExplicitBug>::{closure#0}, !>
  10:     0x794b249b03e9 - std[484d8c24ec532d56]::panicking::begin_panic::<rustc_errors[35018a33f26c22cc]::ExplicitBug>
  11:     0x794b249caa81 - <rustc_errors[35018a33f26c22cc]::diagnostic::BugAbort as rustc_errors[35018a33f26c22cc]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x794b24fe2884 - rustc_middle[da941fcb4ea689b5]::util::bug::opt_span_bug_fmt::<rustc_span[198bb2277a7734d7]::span_encoding::Span>::{closure#0}
  13:     0x794b24fc8b1a - rustc_middle[da941fcb4ea689b5]::ty::context::tls::with_opt::<rustc_middle[da941fcb4ea689b5]::util::bug::opt_span_bug_fmt<rustc_span[198bb2277a7734d7]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x794b24fc89ab - rustc_middle[da941fcb4ea689b5]::ty::context::tls::with_context_opt::<rustc_middle[da941fcb4ea689b5]::ty::context::tls::with_opt<rustc_middle[da941fcb4ea689b5]::util::bug::opt_span_bug_fmt<rustc_span[198bb2277a7734d7]::span_encoding::Span>::{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::<rustc_query_impl[a6b34b6c656310e8]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[da941fcb4ea689b5]::query::erase::Erased<[u8; 16usize]>>
  19:     0x794b269d31d3 - rustc_query_system[43367dc2cdf302c7]::query::plumbing::try_execute_query::<rustc_query_impl[a6b34b6c656310e8]::DynamicConfig<rustc_query_system[43367dc2cdf302c7]::query::caches::DefaultCache<rustc_middle[da941fcb4ea689b5]::ty::ParamEnvAnd<rustc_middle[da941fcb4ea689b5]::ty::Ty>, 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_query_system[43367dc2cdf302c7]::query::caches::DefaultCache<rustc_middle[da941fcb4ea689b5]::ty::ParamEnvAnd<rustc_middle[da941fcb4ea689b5]::ty::Ty>, rustc_middle[da941fcb4ea689b5]::query::erase::Erased<[u8; 16usize]>>>
  22:     0x794b268ab6d8 - <dyn rustc_hir_analysis[6ffe0ea406cdfc5e]::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
  23:     0x794b268b174b - <dyn rustc_hir_analysis[6ffe0ea406cdfc5e]::hir_ty_lowering::HirTyLowerer>::lower_ty
  24:     0x794b268bcaad - <<rustc_hir_typeck[e4ce35102d8b94c1]::fn_ctxt::FnCtxt>::instantiate_value_path::CtorGenericArgsCtxt as rustc_hir_analysis[6ffe0ea406cdfc5e]::hir_ty_lowering::GenericArgsLowerer>::provided_kind
  25:     0x794b26a5e248 - <rustc_hir_typeck[e4ce35102d8b94c1]::fn_ctxt::FnCtxt>::instantiate_value_path
  26:     0x794b26a51d26 - <rustc_hir_typeck[e4ce35102d8b94c1]::fn_ctxt::FnCtxt>::check_expr_path
  27:     0x794b26c9d218 - <rustc_hir_typeck[e4ce35102d8b94c1]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28:     0x794b26c9c084 - <rustc_hir_typeck[e4ce35102d8b94c1]::fn_ctxt::FnCtxt>::check_decl
  29:     0x794b26c992df - <rustc_hir_typeck[e4ce35102d8b94c1]::fn_ctxt::FnCtxt>::check_block_with_expected
  30:     0x794b26c9f853 - <rustc_hir_typeck[e4ce35102d8b94c1]::fn_ctxt::FnCtxt>::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::<rustc_query_impl[a6b34b6c656310e8]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[da941fcb4ea689b5]::query::erase::Erased<[u8; 8usize]>>
  34:     0x794b261ba53a - rustc_query_system[43367dc2cdf302c7]::query::plumbing::try_execute_query::<rustc_query_impl[a6b34b6c656310e8]::DynamicConfig<rustc_query_system[43367dc2cdf302c7]::query::caches::VecCache<rustc_span[198bb2277a7734d7]::def_id::LocalDefId, rustc_middle[da941fcb4ea689b5]::query::erase::Erased<[u8; 8usize]>>, 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 - <rustc_middle[da941fcb4ea689b5]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[6ffe0ea406cdfc5e]::check_crate::{closure#4}>::{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::<rustc_query_impl[a6b34b6c656310e8]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[da941fcb4ea689b5]::query::erase::Erased<[u8; 1usize]>>
  41:     0x794b26f9726e - rustc_query_system[43367dc2cdf302c7]::query::plumbing::try_execute_query::<rustc_query_impl[a6b34b6c656310e8]::DynamicConfig<rustc_query_system[43367dc2cdf302c7]::query::caches::SingleCache<rustc_middle[da941fcb4ea689b5]::query::erase::Erased<[u8; 1usize]>>, 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::<core[5eff1680495eda70]::result::Result<(), rustc_span[198bb2277a7734d7]::ErrorGuaranteed>, rustc_driver_impl[be7972101cd0935a]::run_compiler::{closure#0}>::{closure#1}
  44:     0x794b26e93d90 - std[484d8c24ec532d56]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[d79dc78584d485d1]::util::run_in_thread_with_globals<rustc_interface[d79dc78584d485d1]::util::run_in_thread_pool_with_globals<rustc_interface[d79dc78584d485d1]::interface::run_compiler<core[5eff1680495eda70]::result::Result<(), rustc_span[198bb2277a7734d7]::ErrorGuaranteed>, 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 - <<std[484d8c24ec532d56]::thread::Builder>::spawn_unchecked_<rustc_interface[d79dc78584d485d1]::util::run_in_thread_with_globals<rustc_interface[d79dc78584d485d1]::util::run_in_thread_pool_with_globals<rustc_interface[d79dc78584d485d1]::interface::run_compiler<core[5eff1680495eda70]::result::Result<(), rustc_span[198bb2277a7734d7]::ErrorGuaranteed>, 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 - <unknown>
  48:     0x794b2859d49c - <unknown>
  49:                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: 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 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 Sep 8, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 8, 2024
@matthiaskrgr
Copy link
Member Author

this one also bisects to #127814 cc @folkertdev

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 8, 2024
@lolbinarycat lolbinarycat added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Sep 8, 2024
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 8, 2024
@lolbinarycat lolbinarycat added the A-layout Area: Memory layout of types label Sep 8, 2024
@apiraino
Copy link
Contributor

apiraino commented Sep 9, 2024

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 9, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-layout Area: Memory layout of types C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants