Skip to content

You can pass generic arguments to a module path segment if the module reexports an enum variant #154962

@fmease

Description

@fmease

What the-.

enum Enum<T> { Variant, Carry(T) }

mod module { pub(super) use super::Enum::Variant; }

fn scope() {
    let _ = module::<i32>::Variant; // OK! 😨
    let _ = self::module::<()>::Variant {}; // OK! 😨
}

I expected that we would only allow generic arguments on the penultimate segment if it actually referred to an enum (and no generic arguments were passed to the final segment).

If the second-to-last segment doesn't refer to an enum (here: module), I expected us to prohibit generic argument lists on it.

Metadata

Metadata

Assignees

Labels

A-HIR-ty-loweringArea: HIR ty lowering (HIR → middle::ty IR)A-enumArea: Enums (discriminated unions, or more generally ADTs (algebraic data types))C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions