Skip to content

Are function pointers never dangling? #1967

@xmh0511

Description

@xmh0511

https://doc.rust-lang.org/stable/reference/behavior-considered-undefined.html#r-undefined.dangling says:

A reference/pointer is “dangling” if not all of the bytes it points to are part of the same live allocation (so in particular they all have to be part of some allocation).

According to https://doc.rust-lang.org/reference/types.html#r-type.kinds

Pointer types:

  • References
  • Raw pointers
  • Function pointers

The function pointers are categorized into pointer types. However, a function pointer is never dangling in a program. This should be clarified in section r-undefined.dangling.

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