Skip to content

Support fn() types as const generic parameters #148377

@lyphyser

Description

@lyphyser

Currently even with custom ADT const generics, fn() types are not allowed as const generic parameters types.

Adding that support would quite useful as it would allow to specify a ZST type that implements the Fn/FnOnce/FnMut traits by calling a const fn() value from a conat generic parameter (typically from an fb item), guaranteeing monomorphization.

Currently it seems the only way to do this is to manually create with a macro a separate type for each fn item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)C-enhancementCategory: An issue proposing an enhancement or a PR with one.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions