Skip to content

const_generics with default arguments #70471

Closed
@lcnr

Description

@lcnr

Should the following code be accepted?

// compiles rn
#![feature(const_generics)]

struct A<T = u32, const N: usize> {
    arg: T,
}

type C = A<u32, 7>;

if so, we probably also want to accept the following:

// this currently fails
type B = A<7>;
//~^ ERROR constant provided when a type was expected

playground

cc @varkor @eddyb

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.F-const_generics`#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions