-
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)]`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)]
trait Project {
const SELF: [Self; 1];
}
fn take1(_: Project<SELF = {}>) {}A mutant of glacier2's fixed/123456.rs
Meta
rustc --version --verbose:
rustc 1.93.0-nightly (c90bcb957 2025-11-06)
binary: rustc
commit-hash: c90bcb9571b7aab0d8beaa2ce8a998ffaf079d38
commit-date: 2025-11-06
host: x86_64-apple-darwin
release: 1.93.0-nightly
LLVM version: 21.1.3
Error output
Command: rustc
error[E0601]: `main` function not found in crate `05`
--> 05.rs:7:35
|
7 | fn take1(_: Project<SELF = {}>) {}
| ^ consider adding a `main` function to `05.rs`
warning: trait objects without an explicit `dyn` are deprecated
--> 05.rs:7:13
|
7 | fn take1(_: Project<SELF = {}>) {}
| ^^^^^^^^^^^^^^^^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default
help: if this is a dyn-compatible trait, use `dyn`
|
7 | fn take1(_: dyn Project<SELF = {}>) {}
| +++
error[E0038]: the trait `Project` is not dyn compatible
--> 05.rs:7:13
|
7 | fn take1(_: Project<SELF = {}>) {}
| ^^^^^^^^^^^^^^^^^^ `Project` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
--> 05.rs:4:11
|
3 | trait Project {
| ------- this trait is not dyn compatible...
4 | const SELF: [Self; 1];
| ^^^^ ...because it contains this associated `const`
= help: consider moving `SELF` to another trait
error[E0277]: the size for values of type `Self` cannot be known at compilation time
--> 05.rs:4:17
|
4 | const SELF: [Self; 1];
| ^^^^^^^^^ doesn't have a size known at compile-time
|
= note: slice and array elements must have `Sized` type
help: consider further restricting `Self`
|
3 | trait Project: Sized {
| +++++++
error[E0277]: the size for values of type `(dyn Project + 'static)` cannot be known at compilation time
--> 05.rs:7:13
|
7 | fn take1(_: Project<SELF = {}>) {}
| ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Project + 'static)`
= help: unsized fn params are gated as an unstable feature
help: you can use `impl Trait` as the argument type
|
7 | fn take1(_: impl Project<SELF = {}>) {}
| ++++
help: function arguments must have a statically known size, borrowed types always have a known size
|
7 | fn take1(_: &dyn Project<SELF = {}>) {}
| ++++
error[E0308]: mismatched types
--> 05.rs:7:28
|
7 | fn take1(_: Project<SELF = {}>) {}
| ^^ expected `[FreshTy(0); 1]`, found `()`
|
= note: expected array `[FreshTy(0); 1]`
found unit type `()`
error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:1918:17: `has_trivial_sizedness` applied to unexpected type: FreshTy(0)
thread 'rustc' (5888757) panicked at compiler/rustc_middle/src/ty/sty.rs:1918:17:
Box<dyn Any>
Backtrace
thread 'rustc' (5888757) panicked at compiler/rustc_middle/src/ty/sty.rs:1918:17:
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_middle::ty::Ty>::has_trivial_sizedness
7: rustc_trait_selection::traits::util::sizedness_fast_path
8: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
9: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
10: <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
11: rustc_hir_typeck::typeck_with_inspect::{closure#0}
12: rustc_hir_typeck::typeck
[... omitted 1 frame ...]
13: rustc_hir_typeck::used_trait_imports
[... omitted 1 frame ...]
14: rustc_hir_analysis::check_unused::check_unused_traits
[... omitted 1 frame ...]
15: rustc_hir_analysis::check_crate
16: rustc_interface::passes::analysis
[... omitted 1 frame ...]
17: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
18: 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 `/Users/jb/Library/CloudStorage/Dropbox/Desk/2503_rustc_ice/20251106 ice 보고용/rustc-ice-2025-11-07T05_16_49-2721.txt` to your bug report
query stack during panic:
#0 [typeck] type-checking `take1::{constant#0}`
#1 [used_trait_imports] finding used_trait_imports `take1::{constant#0}`
#2 [check_unused_traits] checking unused trait imports in crate
#3 [analysis] running analysis passes on crate `05`
end of query stack
error: aborting due to 6 previous errors; 1 warning emitted
Some errors have detailed explanations: E0038, E0277, E0308, E0601.
For more information about an error, try `rustc --explain E0038`.
Notes
-
ICE location:
compiler/rustc_middle/src/ty/sty.rs Line-1918
rust/compiler/rustc_middle/src/ty/sty.rs
Lines 1909 to 1919 in c90bcb9
ty::Adt(def, args) => def .sizedness_constraint(tcx, sizedness) .is_none_or(|ty| ty.instantiate(tcx, args).has_trivial_sizedness(tcx, sizedness)), ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) | ty::Bound(..) => false, ty::Infer(ty::TyVar(_)) => false, ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => { bug!("`has_trivial_sizedness` applied to unexpected type: {:?}", self) } -
Duplication Check
- I searched "has_trivial_sizedness" ICE issues, (Github issue page with query); and no ICE issue with that keyword.
@rustbot label +F-associated_const_equality
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)]`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.