Skip to content

Function pointers are not VaArgSafe #153646

@RalfJung

Description

@RalfJung

The VaArgSafe trait is not implemented for fn types -- and fixing that seems non-trivial? There is no easy way to "implement a trait for all function pointers". This is something we may have to figure out before stabilizing #44930 because surely we want to support fn types eventually and so we should be confident that the design we stabilize can accommodate that.

We do have the FnPtr trait, but wouldn't we risk coherence issues if we add something like this?

impl<T: FnPtr> VaArgSafe for T {}

Cc @folkertdev

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-coherenceArea: CoherenceC-discussionCategory: Discussion or questions that doesn't represent real issues.F-c_variadic`#![feature(c_variadic)]`T-typesRelevant to the types 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