Skip to content

PhantomData confusing documentation #125540

@dimbleby

Description

@dimbleby

Location

https://doc.rust-lang.org/std/marker/struct.PhantomData.html#ownership-and-the-drop-check, via

/// `T` in very rare circumstances. This in turn has effects on the Rust compiler's [drop check]

Summary

#103413 updated the documentation for PhantomData to say

Currently, adding a field of type PhantomData<T> indicates that your type owns data of type T in very rare circumstances.

I don't understand. How rare must these circumstances be for me to use PhantomData? What should I do if my type always owns data of type T?

I guess this is not what was meant, but I am finding it hard to figure out what the intention was and propose an improvement.

Possibly just remove the phrase "in very rare circumstances"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    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