-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-associated_const_equality`#![feature(associated_const_equality)]``#![feature(associated_const_equality)]`F-impl_trait_in_assoc_type`#![feature(impl_trait_in_assoc_type)]``#![feature(impl_trait_in_assoc_type)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Description
Code
#![feature(associated_const_equality)]
#![feature(impl_trait_in_assoc_type)]
trait Trait<T> {
const K: T;
}
trait Discard {
type Out;
}
trait Inner {
type T;
}
impl<'a> Inner for &'a i32 {
type T = impl Trait<<fn(&'a str) -> &'a str as Discard>::Out, K = { () }>;
}
fn main() {}A mutant of glacier2's fixed/23406.rs
Meta
rustc --version --verbose:
rustc 1.93.0-nightly (34f954f9b 2025-10-25)
binary: rustc
commit-hash: 34f954f9b7cbdb5e9b408bac1c4ff1e88b5f2719
commit-date: 2025-10-25
host: x86_64-apple-darwin
release: 1.93.0-nightly
LLVM version: 21.1.3
Error output
command: rustc
thread 'rustc' (47100741) panicked at compiler/rustc_middle/src/ty/generics.rs:221:29:
index out of bounds: the len is 0 but the index is 0
Backtrace
thread 'rustc' (47100741) panicked at compiler/rustc_middle/src/ty/generics.rs:221:29:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic_bounds_check
3: <rustc_middle::ty::generics::Generics>::param_at
4: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_poly_trait_ref
5: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_bounds::<&[rustc_hir::hir::GenericBound]>
6: rustc_hir_analysis::collect::item_bounds::opaque_type_bounds
7: rustc_hir_analysis::collect::item_bounds::explicit_item_bounds_with_filter
8: rustc_hir_analysis::collect::item_bounds::explicit_item_self_bounds
[... omitted 2 frames ...]
9: rustc_hir_analysis::collect::item_bounds::item_self_bounds
[... omitted 1 frame ...]
10: <rustc_trait_selection::traits::select::SelectionContext>::assemble_candidates
11: <rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}
12: <rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}
13: <rustc_trait_selection::traits::select::SelectionContext>::poly_select::{closure#0}
14: <rustc_trait_selection::traits::fulfill::FulfillProcessor>::process_trait_obligation
15: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
16: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
17: <rustc_trait_selection::traits::fulfill::FulfillmentContext<rustc_trait_selection::traits::FulfillmentError> as rustc_infer::traits::engine::TraitEngine<rustc_trait_selection::traits::FulfillmentError>>::try_evaluate_obligations
18: <rustc_trait_selection::traits::fulfill::FulfillmentContext<rustc_trait_selection::traits::FulfillmentError> as rustc_infer::traits::engine::TraitEngine<rustc_trait_selection::traits::FulfillmentError>>::evaluate_obligations_error_on_ambiguity
19: rustc_hir_analysis::check::compare_impl_item::check_type_bounds
20: rustc_hir_analysis::check::compare_impl_item::compare_impl_item
[... omitted 1 frame ...]
21: rustc_hir_analysis::check::check::check_impl_items_against_trait
22: rustc_hir_analysis::check::check::check_item_type
23: rustc_hir_analysis::check::wfcheck::check_well_formed
[... omitted 1 frame ...]
24: rustc_hir_analysis::check::wfcheck::check_type_wf
[... omitted 1 frame ...]
25: rustc_hir_analysis::check_crate
26: rustc_interface::passes::analysis
[... omitted 1 frame ...]
27: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
28: 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.
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 `/Volumes/T7/workspace/scratch_250918/rustc-ice-2025-10-26T04_04_40-96550.txt` to your bug report
query stack during panic:
#0 [explicit_item_self_bounds] finding item bounds for `<impl at 2.rs:15:1: 15:27>::T::{opaque#0}`
#1 [item_self_bounds] elaborating item assumptions for `<impl at 2.rs:15:1: 15:27>::T::{opaque#0}`
#2 [compare_impl_item] checking assoc item `<impl at 2.rs:15:1: 15:27>::T` is compatible with trait definition
#3 [check_well_formed] checking that `<impl at 2.rs:15:1: 15:27>` is well-formed
#4 [check_type_wf] checking that types are well-formed
#5 [analysis] running analysis passes on this crate
end of query stack
Regression in
Regression in nightly-2024-10-06
Log
cargo-bisect-rustc --start=2024-07-01 --end=2025-10-25 --regress ice --preserve --script rustc -- 1.rs
searched toolchains nightly-2024-07-01 through nightly-2025-10-25
********************************************************************************
Regression in nightly-2024-10-06
********************************************************************************
fetching https://static.rust-lang.org/dist/2024-10-05/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2024-10-05: 40 B / 40 B [=======================================================] 100.00 % 772.61 KB/s converted 2024-10-05 to 14f303bc1430a78ddaa91b3e104bbe4c0413184e
fetching https://static.rust-lang.org/dist/2024-10-06/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2024-10-06: 40 B / 40 B [=======================================================] 100.00 % 675.02 KB/s converted 2024-10-06 to 9096f4fafa2ac2d771f866337b4ee7064cde8575
looking for regression commit between 2024-10-05 and 2024-10-06
fetching (via remote github) commits from max(14f303bc1430a78ddaa91b3e104bbe4c0413184e, 2024-10-03) to 9096f4fafa2ac2d771f866337b4ee7064cde8575
ending github query because we found starting sha: 14f303bc1430a78ddaa91b3e104bbe4c0413184e
get_commits_between returning commits, len: 11
commit[0] 2024-10-04: Auto merge of #130157 - eduardosm:stabilize-const_float_classify, r=RalfJung
commit[1] 2024-10-04: Auto merge of #131269 - workingjubilee:rollup-bf7fzhf, r=workingjubilee
commit[2] 2024-10-05: Auto merge of #131124 - weihanglo:update-cargo, r=weihanglo
commit[3] 2024-10-05: Auto merge of #131275 - workingjubilee:rollup-4yxqio3, r=workingjubilee
commit[4] 2024-10-05: Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errors
commit[5] 2024-10-05: Auto merge of #3943 - RalfJung:pthread-mutex-reentrant, r=RalfJung
commit[6] 2024-10-05: Auto merge of #3940 - rust-lang:refutable_slice, r=RalfJung
commit[7] 2024-10-05: Auto merge of #131288 - matthiaskrgr:rollup-h0t0v2h, r=matthiaskrgr
commit[8] 2024-10-05: Auto merge of #131188 - Kobzol:remove-libstd-so-from-sysroot, r=onur-ozkan
commit[9] 2024-10-05: Auto merge of #131221 - XrXr:bump-compiler-builtins, r=tgross35
commit[10] 2024-10-05: Auto merge of #131302 - matthiaskrgr:rollup-56kbpzx, r=matthiaskrgr
ERROR: no CI builds available between 14f303bc1430a78ddaa91b3e104bbe4c0413184e and 9096f4fafa2ac2d771f866337b4ee7064cde8575 within last 167 days
Notes
-
ICE location:
rustc_middle/src/ty/generics.rs Line-221
rust/compiler/rustc_middle/src/ty/generics.rs
Lines 218 to 226 in 34f954f
/// Returns the `GenericParamDef` with the given index. pub fn param_at(&'tcx self, param_index: usize, tcx: TyCtxt<'tcx>) -> &'tcx GenericParamDef { if let Some(index) = param_index.checked_sub(self.parent_count) { &self.own_params[index] } else { tcx.generics_of(self.parent.expect("parent_count > 0 but no parent?")) .param_at(param_index, tcx) } } -
I searched for open ICE issues with "generics.rs" query, and the issue-141775 has the same ICE location. However, this one shows different query stack & flags to see ICE. (https://github.com/rust-lang/rust/issues?q=is%3Aissue%20state%3Aopen%20label%3AI-ICE%20%22generics.rs%22)
@rustbot label +F-associated_const_equality +F-impl_trait_in_assoc_type
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-associated_const_equality`#![feature(associated_const_equality)]``#![feature(associated_const_equality)]`F-impl_trait_in_assoc_type`#![feature(impl_trait_in_assoc_type)]``#![feature(impl_trait_in_assoc_type)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.