rust-lang / rust-lang/rust

[ICE]: could not normalize `Foo: 'static`

Open
#156,700 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-checked_type_aliases I-ICE T-compiler WG-trait-system-refactor
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
//@ compile-flags -Znext-solver=globally
#![feature(lazy_type_alias)]
#![feature(trivial_bounds)]
type Foo
    = ()
where
    Foo: 'static;

fn main() {}

Meta

rustc --version --verbose:

rustc 1.97.0-nightly (507271bc1 2026-05-17)
binary: rustc
commit-hash: 507271bc119683008ec719ecee48814e8ac86c65
commit-date: 2026-05-17
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4
Error output
<output>
Backtrace

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

warning: type alias `Foo` is never used
 --> a.rs:4:6
  |
4 | type Foo
  |      ^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: lifetime bound Foo: 'static does not depend on any type or lifetime parameters
 --> a.rs:7:10
  |
7 |     Foo: 'static;
  |          ^^^^^^^
  |
  = note: `#[warn(trivial_bounds)]` on by default

warning: 3 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: could not normalize `Foo: 'static`
  |
  = note: delayed at /rustc-dev/507271bc119683008ec719ecee48814e8ac86c65/compiler/rustc_trait_selection/src/regions.rs:42:41
             0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
             2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
             3: <rustc_errors::DiagCtxtHandle>::delayed_bug::<alloc::string::String>
             4: <rustc_infer::infer::outlives::env::OutlivesEnvironment as rustc_trait_selection::regions::OutlivesEnvironmentBuildExt>::new_with_implied_bounds_compat::<core::iter::adapters::copied::Copied<indexmap::set::iter::Iter<rustc_middle::ty::Ty>>>
             5: rustc_hir_analysis::check::check::check_item_type
             6: rustc_hir_analysis::check::wfcheck::check_well_formed
             7: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
             8: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
             9: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
            10: rustc_hir_analysis::check::wfcheck::check_type_wf
            11: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
            12: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
            13: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
            14: rustc_hir_analysis::check_crate
            15: rustc_interface::passes::analysis
            16: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
            17: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
            18: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
            19: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            20: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            21: <std::sys::thread::unix::Thread>::new::thread_start
            22: <unknown>
            23: <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/im4/2/rustc-ice-2026-05-18T09_14_18-2216916.txt` to your bug report

note: rustc 1.97.0-nightly (507271bc1 2026-05-17) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=globally

query stack during panic:
end of query stack

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.

Research direction

Reproduce the minimal example with -Znext-solver=globally on a current nightly, then inspect compiler/rustc_trait_selection/src/regions.rs around the delayed-bug location and the new_with_implied_bounds_compat call in the backtrace. Trace why normalization of Foo: 'static reaches the ICE, and verify the example no longer emits an internal compiler error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.