-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-generic_const_parameter_types`#![feature(generic_const_parameter_types)]``#![feature(generic_const_parameter_types)]`F-unsized_const_params`#![feature(unsized_const_params)]``#![feature(unsized_const_params)]`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
auto-reduced (treereduce-rust):
#![feature(generic_const_parameter_types)]
struct Bar<'a, const N: &'a u32>;
fn foo(&self) -> Bar<0> {
todo!();
}
original:
#![feature(generic_const_parameter_types)]
#![feature(unsized_const_params)]
#![feature(unsized_const_params)]
struct Bar<'a, const N: &'a u32>;
fn foo(&self) -> Bar<0> { todo!(); }
pub fn main() {}
Version information
rustc 1.92.0-nightly (dd7fda570 2025-09-20)
binary: rustc
commit-hash: dd7fda570040e8a736f7d8bc28ddd1b444aabc82
commit-date: 2025-09-20
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.1
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error: `self` parameter is only allowed in associated functions
--> /tmp/icemaker_global_tempdir.thpkJ4fkiPJl/rustc_testrunner_tmpdir_reporting.vfQda4Joev2S/mvce.rs:4:8
|
4 | fn foo(&self) -> Bar<0> {
| ^^^^^ not semantically valid as function parameter
|
= note: associated functions are those in `impl` or `trait` definitions
warning: the feature `generic_const_parameter_types` is incomplete and may not be safe to use and/or cause compiler crashes
--> /tmp/icemaker_global_tempdir.thpkJ4fkiPJl/rustc_testrunner_tmpdir_reporting.vfQda4Joev2S/mvce.rs:1:12
|
1 | #![feature(generic_const_parameter_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #137626 <https://github.com/rust-lang/rust/issues/137626> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.thpkJ4fkiPJl/rustc_testrunner_tmpdir_reporting.vfQda4Joev2S/mvce.rs:6:2
|
6 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.thpkJ4fkiPJl/rustc_testrunner_tmpdir_reporting.vfQda4Joev2S/mvce.rs`
error[E0392]: lifetime parameter `'a` is never used
--> /tmp/icemaker_global_tempdir.thpkJ4fkiPJl/rustc_testrunner_tmpdir_reporting.vfQda4Joev2S/mvce.rs:3:12
|
3 | struct Bar<'a, const N: &'a u32>;
| ^^ unused lifetime parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
error: `&'a u32` is forbidden as the type of a const generic parameter
--> /tmp/icemaker_global_tempdir.thpkJ4fkiPJl/rustc_testrunner_tmpdir_reporting.vfQda4Joev2S/mvce.rs:3:25
|
3 | struct Bar<'a, const N: &'a u32>;
| ^^^^^^^
|
= note: the only supported types are integers, `bool`, and `char`
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
3 + #![feature(adt_const_params)]
|
help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait
|
3 + #![feature(unsized_const_params)]
|
thread 'rustc' (3574067) panicked at /rustc-dev/dd7fda570040e8a736f7d8bc28ddd1b444aabc82/compiler/rustc_trait_selection/src/traits/normalize.rs:172:9:
Normalizing &'^0.Named(DefId(0:9 ~ mvce[a7ac]::foo::'_)) u32 without wrapping in a `Binder`
stack backtrace:
0: 0x7fc536e02983 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7c6ba7eb3d79c74e
1: 0x7fc537602044 - core::fmt::write::h51b415dc740abb61
2: 0x7fc536db7201 - std::io::Write::write_fmt::h65024e6b411b5d6a
3: 0x7fc536dc86f2 - std::sys::backtrace::BacktraceLock::print::h1fa141d4115fcdc7
4: 0x7fc536dce659 - std::panicking::default_hook::{{closure}}::h5b8d1bafc007debc
5: 0x7fc536dce183 - std::panicking::default_hook::hbee1bd2db26bedfe
6: 0x7fc535df23c7 - std[aa543e5c3b33e14e]::panicking::update_hook::<alloc[25bb32ac37752f7b]::boxed::Box<rustc_driver_impl[4e82038d4654c963]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7fc536dcea7f - std::panicking::panic_with_hook::h8cbd8c4377e6572b
8: 0x7fc536dce83a - std::panicking::panic_handler::{{closure}}::h335ded1aca77b6b6
9: 0x7fc536dc8839 - std::sys::backtrace::__rust_end_short_backtrace::hd229ab5df32e8172
10: 0x7fc536da936d - __rustc[8ed8e68a5aa5849d]::rust_begin_unwind
11: 0x7fc533df3dd0 - core::panicking::panic_fmt::hb55754338c38e2ee
12: 0x7fc537937879 - <rustc_hir_typeck[135be1f05852888c]::fn_ctxt::FnCtxt>::normalize::<rustc_middle[224366ec5639bfdc]::ty::Ty>
13: 0x7fc5379e4ec8 - rustc_hir_typeck[135be1f05852888c]::typeck_with_inspect::{closure#0}
14: 0x7fc5379dfcf6 - rustc_query_impl[c74c6a12e169b097]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c74c6a12e169b097]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 8usize]>>
15: 0x7fc537801344 - rustc_query_system[dabb8f7ac9ad8702]::query::plumbing::try_execute_query::<rustc_query_impl[c74c6a12e169b097]::DynamicConfig<rustc_data_structures[2c2d92c6a626fca3]::vec_cache::VecCache<rustc_span[201c3f2d192352b6]::def_id::LocalDefId, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[dabb8f7ac9ad8702]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c74c6a12e169b097]::plumbing::QueryCtxt, false>
16: 0x7fc537800cc9 - rustc_query_impl[c74c6a12e169b097]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
17: 0x7fc537802195 - rustc_query_impl[c74c6a12e169b097]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c74c6a12e169b097]::query_impl::used_trait_imports::dynamic_query::{closure#2}::{closure#0}, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 8usize]>>
18: 0x7fc537801344 - rustc_query_system[dabb8f7ac9ad8702]::query::plumbing::try_execute_query::<rustc_query_impl[c74c6a12e169b097]::DynamicConfig<rustc_data_structures[2c2d92c6a626fca3]::vec_cache::VecCache<rustc_span[201c3f2d192352b6]::def_id::LocalDefId, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[dabb8f7ac9ad8702]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c74c6a12e169b097]::plumbing::QueryCtxt, false>
19: 0x7fc537800c09 - rustc_query_impl[c74c6a12e169b097]::query_impl::used_trait_imports::get_query_non_incr::__rust_end_short_backtrace
20: 0x7fc5378022c7 - rustc_hir_analysis[84156159369fd08e]::check_unused::check_unused_traits
21: 0x7fc5378021c7 - rustc_query_impl[c74c6a12e169b097]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c74c6a12e169b097]::query_impl::check_unused_traits::dynamic_query::{closure#2}::{closure#0}, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 0usize]>>
22: 0x7fc5385c2a60 - rustc_query_system[dabb8f7ac9ad8702]::query::plumbing::try_execute_query::<rustc_query_impl[c74c6a12e169b097]::DynamicConfig<rustc_query_system[dabb8f7ac9ad8702]::query::caches::SingleCache<rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c74c6a12e169b097]::plumbing::QueryCtxt, false>
23: 0x7fc5385c27c2 - rustc_query_impl[c74c6a12e169b097]::query_impl::check_unused_traits::get_query_non_incr::__rust_end_short_backtrace
24: 0x7fc538043341 - rustc_hir_analysis[84156159369fd08e]::check_crate
25: 0x7fc537802a30 - rustc_interface[ddde8db7de1554b0]::passes::analysis
26: 0x7fc5378026ed - rustc_query_impl[c74c6a12e169b097]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c74c6a12e169b097]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 0usize]>>
27: 0x7fc5385c2a60 - rustc_query_system[dabb8f7ac9ad8702]::query::plumbing::try_execute_query::<rustc_query_impl[c74c6a12e169b097]::DynamicConfig<rustc_query_system[dabb8f7ac9ad8702]::query::caches::SingleCache<rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c74c6a12e169b097]::plumbing::QueryCtxt, false>
28: 0x7fc5385c26b6 - rustc_query_impl[c74c6a12e169b097]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
29: 0x7fc5389027cf - rustc_interface[ddde8db7de1554b0]::passes::create_and_enter_global_ctxt::<core[e1f2d92e823976a5]::option::Option<rustc_interface[ddde8db7de1554b0]::queries::Linker>, rustc_driver_impl[4e82038d4654c963]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
30: 0x7fc53881643e - rustc_interface[ddde8db7de1554b0]::interface::run_compiler::<(), rustc_driver_impl[4e82038d4654c963]::run_compiler::{closure#0}>::{closure#1}
31: 0x7fc538797db8 - std[aa543e5c3b33e14e]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[ddde8db7de1554b0]::util::run_in_thread_with_globals<rustc_interface[ddde8db7de1554b0]::util::run_in_thread_pool_with_globals<rustc_interface[ddde8db7de1554b0]::interface::run_compiler<(), rustc_driver_impl[4e82038d4654c963]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
32: 0x7fc538797a88 - <<std[aa543e5c3b33e14e]::thread::Builder>::spawn_unchecked_<rustc_interface[ddde8db7de1554b0]::util::run_in_thread_with_globals<rustc_interface[ddde8db7de1554b0]::util::run_in_thread_pool_with_globals<rustc_interface[ddde8db7de1554b0]::interface::run_compiler<(), rustc_driver_impl[4e82038d4654c963]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e1f2d92e823976a5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
33: 0x7fc53879ddcd - std::sys::thread::unix::Thread::new::thread_start::ha9de35456108e0f3
34: 0x7fc531e969cb - <unknown>
35: 0x7fc531f1aa0c - <unknown>
36: 0x0 - <unknown>
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: rustc 1.92.0-nightly (dd7fda570 2025-09-20) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `foo::{constant#0}`
#1 [used_trait_imports] finding used_trait_imports `foo::{constant#0}`
#2 [check_unused_traits] checking unused trait imports in crate
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0392, E0601.
For more information about an error, try `rustc --explain E0392`.
@rustbot label +F-generic_const_parameter_types +F-unsized_const_params +F-unsized_const_params
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-generic_const_parameter_types`#![feature(generic_const_parameter_types)]``#![feature(generic_const_parameter_types)]`F-unsized_const_params`#![feature(unsized_const_params)]``#![feature(unsized_const_params)]`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.