Skip to content

functions as const parameters #7

Closed
@lcnr

Description

@lcnr

We currently forbid function pointers as const parameter types, so the following causes an error:

fn foo<const N: fn() -> usize>() {}

The reason we forbid this because comparing function pointers is not deterministic iirc.

Does this non-determinism only occur at runtime, and if so, are there any reasons why we must not allow function pointers as const param types? I think ctfe is fully deterministic wrt function pointers.

cc @oli-obk @RalfJung

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions