rust-lang / rust-lang/rust

[ICE]: `expected a region, but found another kind`

Open
#161,547 2 comments 0 reactions 1 assignee View on GitHub

@im-lunex is already working on this.

Since Aug 23, 2026.

C-bug F-supertrait_item_shadowing I-ICE T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
#![feature(supertrait_item_shadowing)]
#![feature(generic_const_exprs)]
#![feature(non_lifetime_binders)]
trait E<'e> {
    type As;
}
trait F: for</*'a,*/ F> E/*<'a>*/ + for<'e> E<'e> {}
struct G<T>
where
   /*for<'a>*/ T: F<As: E/*<'a>*/> { X: T }

fn main() {}

Meta

rustc --version --verbose:

rustc 1.100.0-nightly (c656540d6 2026-08-21)
binary: rustc
commit-hash: c656540d6467dee1381f0cbd882412d6bd1cd5ae
commit-date: 2026-08-21
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.0
Error output
error[E0106]: missing lifetime specifier
 --> code.rs:7:25
  |
7 | trait F: for</*'a,*/ F> E/*<'a>*/ + for<'e> E<'e> {}
  |                         ^ expected named lifetime parameter
  |
  = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
  |
7 | trait F: for<'a, /*'a,*/ F> E<'a>/*<'a>*/ + for<'e> E<'e> {}
  |              +++             ++++
help: consider introducing a named lifetime parameter
  |
7 | trait F<'a>: for</*'a,*/ F> E<'a>/*<'a>*/ + for<'e> E<'e> {}
  |        ++++                  ++++

error[E0106]: missing lifetime specifier
  --> code.rs:10:25
   |
10 |    /*for<'a>*/ T: F<As: E/*<'a>*/> { X: T }
   |                         ^ expected named lifetime parameter
   |
help: consider making the bound lifetime-generic with a new `'a` lifetime
   |
10 |    /*for<'a>*/ T: F<As: for<'a> E<'a>/*<'a>*/> { X: T }
   |                         +++++++  ++++
help: consider making the bound lifetime-generic with a new `'a` lifetime
   |
10 |    /*for<'a>*/ T: for<'a> F<As: E<'a>/*<'a>*/> { X: T }
   |                   +++++++        ++++
help: consider making the bound lifetime-generic with a new `'a` lifetime
   |
10 |    /*for<'a>*/ for<'a> T: F<As: E<'a>/*<'a>*/> { X: T }
   |                +++++++           ++++
help: consider introducing a named lifetime parameter
   |
 8 ~ struct G<'a, T>
 9 | where
10 ~    /*for<'a>*/ T: F<As: E<'a>/*<'a>*/> { X: T }
   |
   |

warning: `feature(generic_const_exprs)` is not supported with the next-generation trait solver
 --> code.rs:2:12
  |
2 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: `-Znext-solver=globally` is currently enabled by default for testing
  = note: reverted the setting to `-Znext-solver=coherence` for this crate
  = note: the currently stable trait solver will be used for this crate
  = note: see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information

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

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> code.rs:3:12
  |
3 | #![feature(non_lifetime_binders)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
Backtrace

error: internal compiler error: /rustc-dev/b0ca9c712455d865c3bf0bf5325a3e79677a2d97/compiler/rustc_middle/src/ty/generic_args.rs:281:44: expected a region, but found another kind


thread 'rustc' (4042540) panicked at /rustc-dev/b0ca9c712455d865c3bf0bf5325a3e79677a2d97/compiler/rustc_middle/src/ty/generic_args.rs:281:44:
Box<dyn Any>
stack backtrace:
   0:     0x7fea411fc246 - <<std[29541300fb290a5d]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[460910d47b72e8ee]::fmt::Display>::fmt
   1:     0x7fea4180b023 - core[460910d47b72e8ee]::fmt::write
   2:     0x7fea4121172c - <std[29541300fb290a5d]::sys::stdio::unix::Stderr as core[460910d47b72e8ee]::io::write::Write>::write_fmt
   3:     0x7fea411cf61a - std[29541300fb290a5d]::panicking::default_hook::{closure#0}
   4:     0x7fea411f04a3 - std[29541300fb290a5d]::panicking::default_hook
   5:     0x7fea401a89aa - std[29541300fb290a5d]::panicking::update_hook::<alloc[e06df03e17637ff3]::boxed::Box<rustc_driver_impl[56abbf040ce8585c]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fea411f0942 - std[29541300fb290a5d]::panicking::panic_with_hook
   7:     0x7fea401d6f24 - std[29541300fb290a5d]::panicking::begin_panic::<rustc_errors[fdbcaf08f64701c7]::ExplicitBug>::{closure#0}
   8:     0x7fea401cf9be - std[29541300fb290a5d]::sys::backtrace::__rust_end_short_backtrace::<std[29541300fb290a5d]::panicking::begin_panic<rustc_errors[fdbcaf08f64701c7]::ExplicitBug>::{closure#0}, !>
   9:     0x7fea401cda5e - std[29541300fb290a5d]::panicking::begin_panic::<rustc_errors[fdbcaf08f64701c7]::ExplicitBug>
  10:     0x7fea401e2961 - <rustc_errors[fdbcaf08f64701c7]::diagnostic::BugAbort as rustc_errors[fdbcaf08f64701c7]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7fea4074e969 - rustc_middle[9d9ea3708d6e93f5]::util::bug::opt_span_bug_fmt::<rustc_span[7b0e571682104a6f]::span_encoding::Span>::{closure#0}
  12:     0x7fea4074ed62 - rustc_middle[9d9ea3708d6e93f5]::ty::context::tls::with_opt::<rustc_middle[9d9ea3708d6e93f5]::util::bug::opt_span_bug_fmt<rustc_span[7b0e571682104a6f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7fea4073a860 - rustc_middle[9d9ea3708d6e93f5]::ty::context::tls::with_context_opt::<rustc_middle[9d9ea3708d6e93f5]::ty::context::tls::with_opt<rustc_middle[9d9ea3708d6e93f5]::util::bug::opt_span_bug_fmt<rustc_span[7b0e571682104a6f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7fea3d4189b4 - rustc_middle[9d9ea3708d6e93f5]::util::bug::bug_fmt
  15:     0x7fea4396dce5 - <<rustc_infer[775c003696668d9d]::infer::InferCtxt>::instantiate_binder_with_fresh_vars::ToFreshVars as rustc_middle[9d9ea3708d6e93f5]::ty::fold::BoundVarReplacerDelegate>::replace_region.cold
  16:     0x7fea4279374e - <&rustc_middle[9d9ea3708d6e93f5]::ty::list::RawList<(), rustc_middle[9d9ea3708d6e93f5]::ty::generic_args::GenericArg> as rustc_type_ir[c55ed8222f6694be]::fold::TypeFoldable<rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::fold_with::<rustc_middle[9d9ea3708d6e93f5]::ty::fold::BoundVarReplacer<<rustc_infer[775c003696668d9d]::infer::InferCtxt>::instantiate_binder_with_fresh_vars::ToFreshVars>>
  17:     0x7fea4279467a - <rustc_middle[9d9ea3708d6e93f5]::ty::fold::BoundVarReplacer<<rustc_infer[775c003696668d9d]::infer::InferCtxt>::instantiate_binder_with_fresh_vars::ToFreshVars> as rustc_type_ir[c55ed8222f6694be]::fold::TypeFolder<rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::fold_ty
  18:     0x7fea3d8c1db4 - <rustc_trait_selection[6d6a1773eb45fa07]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  19:     0x7fea41d6ed27 - <rustc_trait_selection[6d6a1773eb45fa07]::traits::select::SelectionContext>::poly_select::{closure#0}
  20:     0x7fea41d5b0b5 - rustc_trait_selection[6d6a1773eb45fa07]::traits::project::opt_normalize_projection_term
  21:     0x7fea41d63355 - <rustc_trait_selection[6d6a1773eb45fa07]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[c55ed8222f6694be]::fold::TypeFolder<rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::fold_ty
  22:     0x7fea41d61c93 - <&rustc_middle[9d9ea3708d6e93f5]::ty::list::RawList<(), rustc_middle[9d9ea3708d6e93f5]::ty::generic_args::GenericArg> as rustc_type_ir[c55ed8222f6694be]::fold::TypeFoldable<rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::fold_with::<rustc_trait_selection[6d6a1773eb45fa07]::traits::normalize::AssocTypeNormalizer>
  23:     0x7fea427c5d27 - <rustc_middle[9d9ea3708d6e93f5]::ty::predicate::Clause as rustc_type_ir[c55ed8222f6694be]::fold::TypeFoldable<rustc_middle[9d9ea3708d6e93f5]::ty::context::TyCtxt>>::fold_with::<rustc_trait_selection[6d6a1773eb45fa07]::traits::normalize::AssocTypeNormalizer>
  24:     0x7fea427c527e - <rustc_infer[775c003696668d9d]::infer::at::At as rustc_trait_selection[6d6a1773eb45fa07]::traits::normalize::NormalizeExt>::normalize::<alloc[e06df03e17637ff3]::vec::Vec<rustc_middle[9d9ea3708d6e93f5]::ty::predicate::Clause>>
  25:     0x7fea42d28322 - rustc_trait_selection[6d6a1773eb45fa07]::traits::do_normalize_clauses
  26:     0x7fea41e536c0 - rustc_trait_selection[6d6a1773eb45fa07]::traits::normalize_param_env_or_error
  27:     0x7fea41e5e8ea - rustc_ty_utils[a79d7b537cc149b5]::ty::param_env
  28:     0x7fea4186667d - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_middle[9d9ea3708d6e93f5]::query::caches::DefIdCache<rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 8usize]>>, false>
  29:     0x7fea418662e3 - rustc_query_impl[a298bd9aef25de82]::query_vtables::param_env::execute_query_non_incr::__rust_end_short_backtrace
  30:     0x7fea42097a03 - rustc_hir_analysis[30f31704cfa60f6c]::check::wfcheck::check_type_defn
  31:     0x7fea423ff1f2 - rustc_hir_analysis[30f31704cfa60f6c]::check::check::check_item_type
  32:     0x7fea423f81a6 - rustc_hir_analysis[30f31704cfa60f6c]::check::wfcheck::check_well_formed
  33:     0x7fea423f8187 - rustc_query_impl[a298bd9aef25de82]::query_vtables::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  34:     0x7fea423f77df - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_data_structures[ce2d1b2e5f4b9540]::vec_cache::VecCache<rustc_span[7b0e571682104a6f]::def_id::LocalDefId, rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[9d9ea3708d6e93f5]::dep_graph::graph::DepNodeIndex>, false>
  35:     0x7fea423f7571 - rustc_query_impl[a298bd9aef25de82]::query_vtables::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  36:     0x7fea423f3420 - rustc_hir_analysis[30f31704cfa60f6c]::check::wfcheck::check_type_wf
  37:     0x7fea423f331b - rustc_query_impl[a298bd9aef25de82]::query_vtables::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  38:     0x7fea42a11c49 - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_middle[9d9ea3708d6e93f5]::query::caches::SingleCache<rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 1usize]>>, false>
  39:     0x7fea42a11a2d - rustc_query_impl[a298bd9aef25de82]::query_vtables::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  40:     0x7fea42078c64 - rustc_hir_analysis[30f31704cfa60f6c]::check_crate
  41:     0x7fea4232c0ba - rustc_interface[473d810ada35544b]::passes::analysis
  42:     0x7fea42a1354a - rustc_query_impl[a298bd9aef25de82]::execution::try_execute_query::<rustc_middle[9d9ea3708d6e93f5]::query::caches::SingleCache<rustc_middle[9d9ea3708d6e93f5]::query::erase::ErasedData<[u8; 0usize]>>, false>
  43:     0x7fea42a132eb - rustc_query_impl[a298bd9aef25de82]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
  44:     0x7fea42b85c6b - rustc_interface[473d810ada35544b]::interface::run_compiler::<(), rustc_driver_impl[56abbf040ce8585c]::run_compiler::{closure#0}>::{closure#2}
  45:     0x7fea42bd7582 - std[29541300fb290a5d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[473d810ada35544b]::util::run_in_thread_with_globals<rustc_interface[473d810ada35544b]::util::run_in_thread_pool_with_globals<rustc_interface[473d810ada35544b]::interface::run_compiler<(), rustc_driver_impl[56abbf040ce8585c]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  46:     0x7fea42bd732d - <std[29541300fb290a5d]::thread::lifecycle::spawn_unchecked<rustc_interface[473d810ada35544b]::util::run_in_thread_with_globals<rustc_interface[473d810ada35544b]::util::run_in_thread_pool_with_globals<rustc_interface[473d810ada35544b]::interface::run_compiler<(), rustc_driver_impl[56abbf040ce8585c]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[460910d47b72e8ee]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:     0x7fea42bd4d87 - <std[29541300fb290a5d]::sys::thread::unix::Thread>::new::thread_start
  48:     0x7fea3be97739 - <unknown>
  49:     0x7fea3bf1bedc - <unknown>
  50:                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 `/home/matthias/vcs/github/CRED/rustc-ice-2026-08-22T16_47_15-4042538.txt` to your bug report

note: rustc 1.100.0-nightly (b0ca9c712 2026-08-22) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [param_env] computing normalized predicates of `G`
#1 [check_well_formed] checking that `G` is well-formed
... and 2 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 3 previous errors; 3 warnings emitted

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

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.