Skip to content

associated type_consts can have defaults without the associated_type_defaults feature gate #130288

Closed

Description

@BoxyUwU

The following is valid rust code:

#![feature(min_generic_const_args)

trait Trait {
    #[type_const]`
    const ASSOC: usize = 10;
}

We don't allow this for types, e.g. type Assoc = u32;. I expect associated type consts to have equivalent problems to associated type defaults given they are functionally equivalent in the type system. We should feature gate this under associated_type_defaults

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    A-const-genericsArea: const generics (parameters and arguments)
    F-gca_min_const_items`#![feature(gca_min_const_items)]` (previously: `min_generic_const_args`)
    on Sep 12, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 12, 2024
  3. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 12, 2024
  4. changed the title [-]Trait associated constants can have defaults while types cant[/-] [+]associated type_consts can have defaults without the `associated_type_defaults` feature gate[/+] on Feb 3, 2026
  5. LaneAsade commented on Feb 7, 2026

    @LaneAsade
    Member

    @rustbot claim

  6. added 3 commits that reference this issue on Feb 22, 2026
  7. added a commit that references this issue on Feb 22, 2026
  8. fmease commented on Apr 6, 2026

    @fmease
    Member

    This was fixed in PR #152385.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.F-gca_min_const_items`#![feature(gca_min_const_items)]` (previously: `min_generic_const_args`)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions