Skip to content

Permit multi-segment paths as const generic arguments without {} #77773

Open
@varkor

Description

@varkor
mod m {
    pub const N: u32 = 0;
}

struct S<const X: u32>;

fn main() {
    let _ = S::<m::N>; // error[E0573]: expected type, found constant `m::N`
}

(Playground link)

There's no reason this couldn't be supported, but it's nontrivial to implement: we need to wait until type-checking to disambiguate between types and constants due to associated types (see this Zulip conversation).

This is essentially the same issue as #66615, but it's more visible (and affects min_const_generics).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)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