Skip to content

ICE: region variables should not be hashed #131639

Open
@matthiaskrgr

Description

@matthiaskrgr

Code

rustc l.rs -Cincremental=.

fn main() {
    unsafe { std::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn(&'a ())>(5); }
}

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (6b9676b45 2024-10-12)
binary: rustc
commit-hash: 6b9676b45431a1e531b9c5f7bd289fc36a312749
commit-date: 2024-10-12
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.1

Error output

error[E0261]: use of undeclared lifetime name `'a`
 --> l.rs:3:78
  |
3 |     unsafe { std::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn(&'a ())>(5); }
  |                                                                              ^^ undeclared lifetime
  |
  = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the type lifetime-generic with a new `'a` lifetime
  |
3 |     unsafe { std::mem::transmute::<usize, for<'a> extern "C-cmse-nonsecure-call" fn(&'a ())>(5); }
  |                                           +++++++
help: consider introducing lifetime `'a` here
  |
2 | fn main<'a>() {
  |        ++++

error[E0658]: C-cmse-nonsecure-call ABI is experimental and subject to change
 --> l.rs:3:50
  |
3 |     unsafe { std::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn(&'a ())>(5); }
  |                                                  ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = 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-10-12; consider upgrading it if it is out of date
Backtrace

thread 'rustc' panicked at /rustc/6b9676b45431a1e531b9c5f7bd289fc36a312749/compiler/rustc_type_ir/src/region_kind.rs:238:17:
region variables should not be hashed: '?0
stack backtrace:
   0:     0x724fa79ca41a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h8b2043b14ab05304
   1:     0x724fa82034a6 - core::fmt::write::hf9887d457cdbc966
   2:     0x724fa941e951 - std::io::Write::write_fmt::ha659b10ba83556c4
   3:     0x724fa79ca272 - std::sys::backtrace::BacktraceLock::print::hf85affc2cf4419f7
   4:     0x724fa79cc746 - std::panicking::default_hook::{{closure}}::hde5089a7c4039350
   5:     0x724fa79cc590 - std::panicking::default_hook::hf6b38aee6b14f9c5
   6:     0x724fa6a249ff - std[b9c4ef606f74e7a3]::panicking::update_hook::<alloc[8572a0bce597bd99]::boxed::Box<rustc_driver_impl[e627dad8a5ad147c]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x724fa79cce58 - std::panicking::rust_panic_with_hook::hafbd7f0e47ba5b9a
   8:     0x724fa79ccc2a - std::panicking::begin_panic_handler::{{closure}}::heb41764772c3697f
   9:     0x724fa79ca8c9 - std::sys::backtrace::__rust_end_short_backtrace::hcc198f67593013e0
  10:     0x724fa79cc8ec - rust_begin_unwind
  11:     0x724fa53758b0 - core::panicking::panic_fmt::hd2428fc03641ffed
  12:     0x724fa83b3e87 - <rustc_type_ir[b367b32ea2ea77f7]::ty_info::WithCachedTypeInfo<rustc_type_ir[b367b32ea2ea77f7]::ty_kind::TyKind<rustc_middle[3e2c59a537b514a7]::ty::context::TyCtxt>> as rustc_data_structures[d65d6190c281c564]::stable_hasher::HashStable<rustc_query_system[2162b26b9e1c67a3]::ich::hcx::StableHashingContext>>::hash_stable
  13:     0x724fa87ca803 - rustc_query_system[2162b26b9e1c67a3]::query::plumbing::try_execute_query::<rustc_query_impl[5ae70715c347e1a5]::DynamicConfig<rustc_query_system[2162b26b9e1c67a3]::query::caches::DefaultCache<rustc_middle[3e2c59a537b514a7]::ty::ParamEnvAnd<rustc_middle[3e2c59a537b514a7]::ty::Ty>, rustc_middle[3e2c59a537b514a7]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[5ae70715c347e1a5]::plumbing::QueryCtxt, true>
  14:     0x724fa87c9b29 - rustc_query_impl[5ae70715c347e1a5]::query_impl::layout_of::get_query_incr::__rust_end_short_backtrace
  15:     0x724fa911295e - rustc_middle[3e2c59a537b514a7]::query::plumbing::query_get_at::<rustc_query_system[2162b26b9e1c67a3]::query::caches::DefaultCache<rustc_middle[3e2c59a537b514a7]::ty::ParamEnvAnd<rustc_middle[3e2c59a537b514a7]::ty::Ty>, rustc_middle[3e2c59a537b514a7]::query::erase::Erased<[u8; 16usize]>>>
  16:     0x724fa8b042e0 - <dyn rustc_hir_analysis[b8eef9b6240b8e77]::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
  17:     0x724fa8b0a4bf - <dyn rustc_hir_analysis[b8eef9b6240b8e77]::hir_ty_lowering::HirTyLowerer>::lower_ty
  18:     0x724fa82b539e - <<rustc_hir_typeck[fded10133472f41e]::fn_ctxt::FnCtxt>::instantiate_value_path::CtorGenericArgsCtxt as rustc_hir_analysis[b8eef9b6240b8e77]::hir_ty_lowering::GenericArgsLowerer>::provided_kind
  19:     0x724fa82ad3e1 - <rustc_hir_typeck[fded10133472f41e]::fn_ctxt::FnCtxt>::instantiate_value_path
  20:     0x724fa82a16d0 - <rustc_hir_typeck[fded10133472f41e]::fn_ctxt::FnCtxt>::check_expr_path
  21:     0x724fa8e74092 - <rustc_hir_typeck[fded10133472f41e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  22:     0x724fa8e75d77 - <rustc_hir_typeck[fded10133472f41e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:     0x724fa8e6f6aa - <rustc_hir_typeck[fded10133472f41e]::fn_ctxt::FnCtxt>::check_block_with_expected
  24:     0x724fa8e76923 - <rustc_hir_typeck[fded10133472f41e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  25:     0x724fa8e6f78a - <rustc_hir_typeck[fded10133472f41e]::fn_ctxt::FnCtxt>::check_block_with_expected
  26:     0x724fa8e76923 - <rustc_hir_typeck[fded10133472f41e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:     0x724fa8b91a26 - rustc_hir_typeck[fded10133472f41e]::check::check_fn
  28:     0x724fa8b86761 - rustc_hir_typeck[fded10133472f41e]::typeck
  29:     0x724fa8b860cf - rustc_query_impl[5ae70715c347e1a5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5ae70715c347e1a5]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3e2c59a537b514a7]::query::erase::Erased<[u8; 8usize]>>
  30:     0x724fa85ffbd7 - rustc_query_system[2162b26b9e1c67a3]::query::plumbing::try_execute_query::<rustc_query_impl[5ae70715c347e1a5]::DynamicConfig<rustc_query_system[2162b26b9e1c67a3]::query::caches::VecCache<rustc_span[6af807c565a72bbf]::def_id::LocalDefId, rustc_middle[3e2c59a537b514a7]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5ae70715c347e1a5]::plumbing::QueryCtxt, true>
  31:     0x724fa85da854 - rustc_query_impl[5ae70715c347e1a5]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
  32:     0x724fa85fbb61 - <rustc_middle[3e2c59a537b514a7]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[b8eef9b6240b8e77]::check_crate::{closure#4}>::{closure#0}
  33:     0x724fa85f9a9b - rustc_hir_analysis[b8eef9b6240b8e77]::check_crate
  34:     0x724fa85f64d7 - rustc_interface[a3bf963724784d96]::passes::run_required_analyses
  35:     0x724fa8f6a65e - rustc_interface[a3bf963724784d96]::passes::analysis
  36:     0x724fa8f6a631 - rustc_query_impl[5ae70715c347e1a5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5ae70715c347e1a5]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3e2c59a537b514a7]::query::erase::Erased<[u8; 1usize]>>
  37:     0x724fa92d530d - rustc_query_system[2162b26b9e1c67a3]::query::plumbing::try_execute_query::<rustc_query_impl[5ae70715c347e1a5]::DynamicConfig<rustc_query_system[2162b26b9e1c67a3]::query::caches::SingleCache<rustc_middle[3e2c59a537b514a7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5ae70715c347e1a5]::plumbing::QueryCtxt, true>
  38:     0x724fa92d4dfa - rustc_query_impl[5ae70715c347e1a5]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  39:     0x724fa8f7b0de - rustc_interface[a3bf963724784d96]::interface::run_compiler::<core[208fe08024603fa1]::result::Result<(), rustc_span[6af807c565a72bbf]::ErrorGuaranteed>, rustc_driver_impl[e627dad8a5ad147c]::run_compiler::{closure#0}>::{closure#1}
  40:     0x724fa90244d4 - std[b9c4ef606f74e7a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a3bf963724784d96]::util::run_in_thread_with_globals<rustc_interface[a3bf963724784d96]::util::run_in_thread_pool_with_globals<rustc_interface[a3bf963724784d96]::interface::run_compiler<core[208fe08024603fa1]::result::Result<(), rustc_span[6af807c565a72bbf]::ErrorGuaranteed>, rustc_driver_impl[e627dad8a5ad147c]::run_compiler::{closure#0}>::{closure#1}, core[208fe08024603fa1]::result::Result<(), rustc_span[6af807c565a72bbf]::ErrorGuaranteed>>::{closure#0}, core[208fe08024603fa1]::result::Result<(), rustc_span[6af807c565a72bbf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[208fe08024603fa1]::result::Result<(), rustc_span[6af807c565a72bbf]::ErrorGuaranteed>>
  41:     0x724fa90248e8 - <<std[b9c4ef606f74e7a3]::thread::Builder>::spawn_unchecked_<rustc_interface[a3bf963724784d96]::util::run_in_thread_with_globals<rustc_interface[a3bf963724784d96]::util::run_in_thread_pool_with_globals<rustc_interface[a3bf963724784d96]::interface::run_compiler<core[208fe08024603fa1]::result::Result<(), rustc_span[6af807c565a72bbf]::ErrorGuaranteed>, rustc_driver_impl[e627dad8a5ad147c]::run_compiler::{closure#0}>::{closure#1}, core[208fe08024603fa1]::result::Result<(), rustc_span[6af807c565a72bbf]::ErrorGuaranteed>>::{closure#0}, core[208fe08024603fa1]::result::Result<(), rustc_span[6af807c565a72bbf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[208fe08024603fa1]::result::Result<(), rustc_span[6af807c565a72bbf]::ErrorGuaranteed>>::{closure#1} as core[208fe08024603fa1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x724fa90253ab - std::sys::pal::unix::thread::Thread::new::thread_start::h0e0386f9f8272e66
  43:     0x724faa67739d - <unknown>
  44:     0x724faa6fc49c - <unknown>
  45:                0x0 - <unknown>

error: 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: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im/rustc-ice-2024-10-13T07_13_22-625025.txt` to your bug report

note: compiler flags: -C incremental=[REDACTED]

query stack during panic:
panicked at /rustc/6b9676b45431a1e531b9c5f7bd289fc36a312749/compiler/rustc_type_ir/src/region_kind.rs:238:17:

thread panicked while processing panic. aborting.
[2]    625025 IOT instruction  rustc l.rs -Cincremental=.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.F-cmse_nonsecure_entry`#![feature(cmse_nonsecure_entry)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: a bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions