rust-lang / rust-lang/rust

enabling `generic_const_parameter_types` breaks `unsized_const_params`

Open
#160,655 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I tried this code: Playground

#![feature(adt_const_params)]
#![feature(unsized_const_params)]
#![feature(generic_const_parameter_types)] // comment me out!
//
#![allow(incomplete_features)]

pub struct Foo<const S: &'static [()]>;

fn breaks() {
    let _: Foo<{ &[] }> = Foo;
}

I expected to see this happen: compiles fine.

Instead, this happened: doesn't compile.

Removing #![feature(generic_const_parameter_types)] (whose functionality is unused here afaict) makes this start compiling as expected.

Meta

rustc --version --verbose: (Playground)

1.99.0-nightly (2026-08-05 7608eb7b07eaf93f16d7)
Backtrace

Compiling playground v0.0.1 (/playground)
error: anonymous constants with lifetimes in their type are not yet supported
  --> src/lib.rs:10:16
   |
10 |     let _: Foo<{ &[] }> = Foo;
   |                ^^^^^^^

error: could not compile `playground` (lib) due to 1 previous error

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 by reproducing the Playground example with adt_const_params, unsized_const_params, and generic_const_parameter_types enabled, then compare it with the version where the last feature is removed. Trace the compiler path that emits "anonymous constants with lifetimes in their type are not yet supported" for Foo<{ &[] }>; done means the example compiles with all three features enabled.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.