rust-lang / rust-lang/rust

[ICE]: `add_outlives_bounds: unexpected regions: (ReLateParam(...`

Open
#152,891 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Code
#![allow(incomplete_features)]
#![feature(adt_const_params, unsized_const_params)]

const FOO_ARR: &[&'static str; 2] = &["Hello", "Friend"];
struct FooConst<const ARRAY: &'static [&'static str]> {}

fn foo<'a>(x: &FooConst<FOO_ARR>) {}

fn main() {}

Mutant of tests/ui/consts/refs_check_const_value_eq-issue-88876.rs

Meta

rustc --version --verbose:

rustc 1.95.0-nightly (7f99507f5 2026-02-19)
binary: rustc
commit-hash: 7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312
commit-date: 2026-02-19
host: x86_64-apple-darwin
release: 1.95.0-nightly
LLVM version: 22.1.0
Error output

Command: rustc

error: internal compiler error: /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_infer/src/infer/outlives/env.rs:85:26: add_outlives_bounds: unexpected regions: (ReLateParam(DefId(0:7 ~ iter2_d769674d73a3095e[428b]::foo), LateNamed(DefId(0:10 ~ iter2_d769674d73a3095e[428b]::foo::'_))), '{erased})


thread 'rustc' (15548693) panicked at /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_infer/src/infer/outlives/env.rs:85:26:
Box<dyn Any>
Backtrace

thread 'rustc' (15548693) panicked at /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_infer/src/infer/outlives/env.rs:85:26:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   5: rustc_middle::util::bug::bug_fmt
   6: <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>>>
   7: rustc_hir_analysis::check::wfcheck::check_item_fn
   8: rustc_hir_analysis::check::check::check_item_type
   9: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 1 frame ...]
  10: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 1 frame ...]
  11: rustc_hir_analysis::check_crate
  12: rustc_interface::passes::analysis
  13: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, {rustc_query_impl::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
  14: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  15: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 `/Volumes/T7/workspace/out-260219/scratch/rustc-ice-2026-02-20T08_22_25-76844.txt` to your bug report

note: rustc 1.95.0-nightly (7f99507f5 2026-02-19) running on x86_64-apple-darwin

query stack during panic:
#0 [check_well_formed] checking that `foo` is well-formed
#1 [check_type_wf] checking that types are well-formed
#2 [analysis] running analysis passes on crate `iter2_d769674d73a3095e`
end of query stack
error: aborting due to 1 previous error

Regression

searched nightlies: from nightly-2025-01-01 to nightly-2026-02-18
regressed nightly: nightly-2025-12-25
searched commit range: https://github.com/rust-lang/rust/compare/2ca7bcd03b87b52f7055a59b817443b0ac4a530d...e7d44143a12a526488e4f0c0d7ea8e62a4fe9354
regressed commit: https://github.com/rust-lang/rust/commit/8796b3b8b4ac6f38a80bf80ce89dd7bd7f92edd7

bisected with cargo-bisect-rustc v0.6.11

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2025-01-01 --end=2026-02-18 --regress ice --preserve --script rustc -- outlives.rs 
Notes

@rustbot label +F-adt_const_params +F-unsized_const_params

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

Start with compiler/rustc_infer/src/infer/outlives/env.rs at line 85 and reproduce the ICE with the Rust code in the issue using rustc. Read the surrounding outlives handling, then inspect the listed regression commit and related issues for context. Done means the reproducer no longer triggers an internal compiler error and the regression is covered by an appropriate compiler test.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.