rust-lang / rust-lang/rust

[ICE]: cannot find .. in param-env

Open
#155,800 2 comments 0 reactions 1 assignee View on GitHub

@folkertdev is already working on this.

Since Jun 3, 2026.

C-bug F-abi_cmse_nonsecure_call F-cmse_nonsecure_entry F-inherent_associated_types I-ICE needs-triage T-compiler
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

https://godbolt.org/z/T5xYeqWbv

original:

#![feature(inherent_associated_types)]
#![feature(cmse_nonsecure_entry)]
struct X<const N: usize> {}
impl<const Z: usize> X<Z> {
    type Output = usize;

    extern "cmse-nonsecure-entry" fn call_once(self) -> Self::Output {
        0usize
    }
}

fn main() {}

Version information

rustc 1.97.0-nightly (9838411cb 2026-04-25)
binary: rustc
commit-hash: 9838411cb723b60dc62b1625751075c4d933b992
commit-date: 2026-04-25
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.2

Possibly related line of code:
https://github.com/rust-lang/rust/blob/9838411cb723b60dc62b1625751075c4d933b992/compiler/rustc_middle/src/ty/sty.rs#L352-L364

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

Program output

warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
 --> a.rs:1:12
  |
1 | #![feature(inherent_associated_types)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0570]: "cmse-nonsecure-entry" is not a supported ABI for the current target
 --> a.rs:7:12
  |
7 |     extern "cmse-nonsecure-entry" fn call_once(self) -> Self::Output {
  |            ^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: /rustc-dev/9838411cb723b60dc62b1625751075c4d933b992/compiler/rustc_middle/src/ty/sty.rs:358:13: cannot find `Z/#0` in param-env: ParamEnv {
                                    caller_bounds: [],
                                }


thread 'rustc' (199727) panicked at /rustc-dev/9838411cb723b60dc62b1625751075c4d933b992/compiler/rustc_middle/src/ty/sty.rs:358:13:
Box<dyn Any>
stack backtrace:
   0:     0x7f515fd8bf8b - <<std[1786388830a04a8d]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[e8d809a99398819b]::fmt::Display>::fmt
   1:     0x7f516042d988 - core[e8d809a99398819b]::fmt::write
   2:     0x7f515fda2bc6 - <std[1786388830a04a8d]::sys::stdio::unix::Stderr as std[1786388830a04a8d]::io::Write>::write_fmt
   3:     0x7f515fd62208 - std[1786388830a04a8d]::panicking::default_hook::{closure#0}
   4:     0x7f515fd7f5f3 - std[1786388830a04a8d]::panicking::default_hook
   5:     0x7f515ed3f87c - std[1786388830a04a8d]::panicking::update_hook::<alloc[f5a461388265045a]::boxed::Box<rustc_driver_impl[da6b3b23f136fde3]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f515fd7f8d2 - std[1786388830a04a8d]::panicking::panic_with_hook
   7:     0x7f515ed6f6b1 - std[1786388830a04a8d]::panicking::begin_panic::<rustc_errors[f0680982b6380391]::ExplicitBug>::{closure#0}
   8:     0x7f515ed68116 - std[1786388830a04a8d]::sys::backtrace::__rust_end_short_backtrace::<std[1786388830a04a8d]::panicking::begin_panic<rustc_errors[f0680982b6380391]::ExplicitBug>::{closure#0}, !>
   9:     0x7f515ed660f8 - std[1786388830a04a8d]::panicking::begin_panic::<rustc_errors[f0680982b6380391]::ExplicitBug>
  10:     0x7f515ed7a9f1 - <rustc_errors[f0680982b6380391]::diagnostic::BugAbort as rustc_errors[f0680982b6380391]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f515f378b89 - rustc_middle[cc385d643382efa7]::util::bug::opt_span_bug_fmt::<rustc_span[13a33207dce17326]::span_encoding::Span>::{closure#0}
  12:     0x7f515f378d12 - rustc_middle[cc385d643382efa7]::ty::context::tls::with_opt::<rustc_middle[cc385d643382efa7]::util::bug::opt_span_bug_fmt<rustc_span[13a33207dce17326]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7f515f368f0b - rustc_middle[cc385d643382efa7]::ty::context::tls::with_context_opt::<rustc_middle[cc385d643382efa7]::ty::context::tls::with_opt<rustc_middle[cc385d643382efa7]::util::bug::opt_span_bug_fmt<rustc_span[13a33207dce17326]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7f515c5c4cc4 - rustc_middle[cc385d643382efa7]::util::bug::bug_fmt
  15:     0x7f5161e99393 - <rustc_middle[cc385d643382efa7]::ty::sty::ParamConst>::find_const_ty_from_env.cold
  16:     0x7f5160c19a61 - <rustc_trait_selection[99603eebc95fc94f]::traits::fulfill::FulfillProcessor as rustc_data_structures[4ac8ada75e009637]::obligation_forest::ObligationProcessor>::process_obligation
  17:     0x7f5160405d50 - <rustc_data_structures[4ac8ada75e009637]::obligation_forest::ObligationForest<rustc_trait_selection[99603eebc95fc94f]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[99603eebc95fc94f]::traits::fulfill::FulfillProcessor>
  18:     0x7f51609bfd53 - <rustc_trait_selection[99603eebc95fc94f]::traits::engine::ObligationCtxt>::make_canonicalized_query_response::<rustc_middle[cc385d643382efa7]::traits::query::NormalizationResult>
  19:     0x7f515fc7a7a4 - rustc_traits[d2ffa449415162fa]::normalize_projection_ty::normalize_canonicalized_inherent_projection
  20:     0x7f51609bd010 - rustc_query_impl[af88a8b7c3088726]::execution::try_execute_query::<rustc_middle[cc385d643382efa7]::query::caches::DefaultCache<rustc_type_ir[e12b6678dcb2cef]::canonical::CanonicalQueryInput<rustc_middle[cc385d643382efa7]::ty::context::TyCtxt, rustc_middle[cc385d643382efa7]::ty::ParamEnvAnd<rustc_type_ir[e12b6678dcb2cef]::predicate::AliasTerm<rustc_middle[cc385d643382efa7]::ty::context::TyCtxt>>>, rustc_middle[cc385d643382efa7]::query::erase::ErasedData<[u8; 8usize]>>, false>
  21:     0x7f515f81db17 - rustc_query_impl[af88a8b7c3088726]::query_impl::normalize_canonicalized_inherent_projection::execute_query_non_incr::__rust_end_short_backtrace
  22:     0x7f516083ce0d - <rustc_trait_selection[99603eebc95fc94f]::traits::query::normalize::QueryNormalizer>::try_fold_free_or_assoc
  23:     0x7f5160839274 - <rustc_trait_selection[99603eebc95fc94f]::traits::query::normalize::QueryNormalizer as rustc_type_ir[e12b6678dcb2cef]::fold::FallibleTypeFolder<rustc_middle[cc385d643382efa7]::ty::context::TyCtxt>>::try_fold_ty
  24:     0x7f516083680f - <rustc_traits[d2ffa449415162fa]::normalize_erasing_regions::provide::{closure#0} as core[e8d809a99398819b]::ops::function::FnOnce<(rustc_middle[cc385d643382efa7]::ty::context::TyCtxt, rustc_middle[cc385d643382efa7]::ty::PseudoCanonicalInput<rustc_middle[cc385d643382efa7]::ty::generic_args::GenericArg>)>>::call_once
  25:     0x7f5160d499b8 - rustc_query_impl[af88a8b7c3088726]::execution::try_execute_query::<rustc_middle[cc385d643382efa7]::query::caches::DefaultCache<rustc_middle[cc385d643382efa7]::ty::PseudoCanonicalInput<rustc_middle[cc385d643382efa7]::ty::generic_args::GenericArg>, rustc_middle[cc385d643382efa7]::query::erase::ErasedData<[u8; 8usize]>>, false>
  26:     0x7f5160d4968d - rustc_query_impl[af88a8b7c3088726]::query_impl::try_normalize_generic_arg_after_erasing_regions::execute_query_non_incr::__rust_end_short_backtrace
  27:     0x7f5160d48dc7 - <rustc_middle[cc385d643382efa7]::ty::normalize_erasing_regions::TryNormalizeAfterErasingRegionsFolder as rustc_type_ir[e12b6678dcb2cef]::fold::FallibleTypeFolder<rustc_middle[cc385d643382efa7]::ty::context::TyCtxt>>::try_fold_ty
  28:     0x7f5160b129e3 - rustc_ty_utils[3ac6a6607bb0a95c]::layout::layout_of
  29:     0x7f5160b1282f - rustc_query_impl[af88a8b7c3088726]::query_impl::layout_of::invoke_provider_fn::__rust_begin_short_backtrace
  30:     0x7f5160d8e682 - rustc_query_impl[af88a8b7c3088726]::execution::try_execute_query::<rustc_middle[cc385d643382efa7]::query::caches::DefaultCache<rustc_middle[cc385d643382efa7]::ty::PseudoCanonicalInput<rustc_middle[cc385d643382efa7]::ty::Ty>, rustc_middle[cc385d643382efa7]::query::erase::ErasedData<[u8; 16usize]>>, false>
  31:     0x7f5160d8e2c8 - rustc_query_impl[af88a8b7c3088726]::query_impl::layout_of::execute_query_non_incr::__rust_end_short_backtrace
  32:     0x7f5160ac53bb - <dyn rustc_hir_analysis[3b758041a560631b]::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
  33:     0x7f5160ac3c05 - rustc_hir_analysis[3b758041a560631b]::collect::lower_fn_sig_recovering_infer_ret_ty
  34:     0x7f5160576c8b - rustc_hir_analysis[3b758041a560631b]::collect::fn_sig
  35:     0x7f5160576466 - rustc_query_impl[af88a8b7c3088726]::query_impl::fn_sig::invoke_provider_fn::__rust_begin_short_backtrace
  36:     0x7f516057a558 - rustc_query_impl[af88a8b7c3088726]::execution::try_execute_query::<rustc_middle[cc385d643382efa7]::query::caches::DefIdCache<rustc_middle[cc385d643382efa7]::query::erase::ErasedData<[u8; 24usize]>>, false>
  37:     0x7f5160579cb1 - rustc_query_impl[af88a8b7c3088726]::query_impl::fn_sig::execute_query_non_incr::__rust_end_short_backtrace
  38:     0x7f5160a83270 - <rustc_hir_analysis[3b758041a560631b]::variance::constraints::ConstraintContext>::build_constraints_for_item
  39:     0x7f515d5b562d - rustc_hir_analysis[3b758041a560631b]::variance::crate_variances
  40:     0x7f516158a52c - rustc_query_impl[af88a8b7c3088726]::query_impl::crate_variances::invoke_provider_fn::__rust_begin_short_backtrace
  41:     0x7f5161587259 - rustc_query_impl[af88a8b7c3088726]::execution::try_execute_query::<rustc_middle[cc385d643382efa7]::query::caches::SingleCache<rustc_middle[cc385d643382efa7]::query::erase::ErasedData<[u8; 8usize]>>, false>
  42:     0x7f5161585879 - rustc_query_impl[af88a8b7c3088726]::query_impl::crate_variances::execute_query_non_incr::__rust_end_short_backtrace
  43:     0x7f5161a6e288 - rustc_query_impl[af88a8b7c3088726]::query_impl::variances_of::invoke_provider_fn::__rust_begin_short_backtrace.warm
  44:     0x7f5160572b05 - rustc_query_impl[af88a8b7c3088726]::execution::try_execute_query::<rustc_middle[cc385d643382efa7]::query::caches::DefIdCache<rustc_middle[cc385d643382efa7]::query::erase::ErasedData<[u8; 16usize]>>, false>
  45:     0x7f516057258d - rustc_query_impl[af88a8b7c3088726]::query_impl::variances_of::execute_query_non_incr::__rust_end_short_backtrace
  46:     0x7f5160abfe30 - rustc_hir_analysis[3b758041a560631b]::check::wfcheck::check_variances_for_type_defn
  47:     0x7f5160a160b1 - rustc_hir_analysis[3b758041a560631b]::check::check::check_item_type
  48:     0x7f5160a108e6 - rustc_hir_analysis[3b758041a560631b]::check::wfcheck::check_well_formed
  49:     0x7f5160a108c7 - rustc_query_impl[af88a8b7c3088726]::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  50:     0x7f5160a0feb2 - rustc_query_impl[af88a8b7c3088726]::execution::try_execute_query::<rustc_data_structures[4ac8ada75e009637]::vec_cache::VecCache<rustc_span[13a33207dce17326]::def_id::LocalDefId, rustc_middle[cc385d643382efa7]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[cc385d643382efa7]::dep_graph::graph::DepNodeIndex>, false>
  51:     0x7f5160a0fc47 - rustc_query_impl[af88a8b7c3088726]::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  52:     0x7f5160a0be49 - rustc_hir_analysis[3b758041a560631b]::check::wfcheck::check_type_wf
  53:     0x7f5160a0bd53 - rustc_query_impl[af88a8b7c3088726]::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  54:     0x7f5161588590 - rustc_query_impl[af88a8b7c3088726]::execution::try_execute_query::<rustc_middle[cc385d643382efa7]::query::caches::SingleCache<rustc_middle[cc385d643382efa7]::query::erase::ErasedData<[u8; 1usize]>>, false>
  55:     0x7f5161588369 - rustc_query_impl[af88a8b7c3088726]::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  56:     0x7f51606f2d29 - rustc_hir_analysis[3b758041a560631b]::check_crate
  57:     0x7f51612836a7 - rustc_interface[55fbf8829e20395b]::passes::analysis
  58:     0x7f5161585e09 - rustc_query_impl[af88a8b7c3088726]::execution::try_execute_query::<rustc_middle[cc385d643382efa7]::query::caches::SingleCache<rustc_middle[cc385d643382efa7]::query::erase::ErasedData<[u8; 0usize]>>, false>
  59:     0x7f5161585a69 - rustc_query_impl[af88a8b7c3088726]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  60:     0x7f5161524cab - rustc_interface[55fbf8829e20395b]::interface::run_compiler::<(), rustc_driver_impl[da6b3b23f136fde3]::run_compiler::{closure#0}>::{closure#1}
  61:     0x7f5161576484 - std[1786388830a04a8d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[55fbf8829e20395b]::util::run_in_thread_with_globals<rustc_interface[55fbf8829e20395b]::util::run_in_thread_pool_with_globals<rustc_interface[55fbf8829e20395b]::interface::run_compiler<(), rustc_driver_impl[da6b3b23f136fde3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  62:     0x7f5161576b6d - <std[1786388830a04a8d]::thread::lifecycle::spawn_unchecked<rustc_interface[55fbf8829e20395b]::util::run_in_thread_with_globals<rustc_interface[55fbf8829e20395b]::util::run_in_thread_pool_with_globals<rustc_interface[55fbf8829e20395b]::interface::run_compiler<(), rustc_driver_impl[da6b3b23f136fde3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e8d809a99398819b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  63:     0x7f51615779ec - <std[1786388830a04a8d]::sys::thread::unix::Thread>::new::thread_start
  64:     0x7f515b0a597a - <unknown>
  65:     0x7f515b1292bc - <unknown>
  66:                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/im2/rustc-ice-2026-04-25T22_40_16-199725.txt` to your bug report

note: rustc 1.97.0-nightly (9838411cb 2026-04-25) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [normalize_canonicalized_inherent_projection] normalizing `X<Z>::Output`
#1 [try_normalize_generic_arg_after_erasing_regions] normalizing `X<Z>::Output`
#2 [layout_of] computing layout of `X<Z>::Output`
#3 [fn_sig] computing function signature of `<impl at a.rs:4:1: 4:26>::call_once`
#4 [crate_variances] computing the variances for items in this crate
#5 [variances_of] computing the variances of `X`
#6 [check_well_formed] checking that `X` is well-formed
#7 [check_type_wf] checking that types are well-formed
#8 [analysis] running analysis passes on crate `a`
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0570`.

@rustbot label +F-inherent_associated_types +F-cmse_nonsecure_entry

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.