Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove confusing comment about ideally using ! for c_void #56594

Merged
merged 2 commits into from
Jan 18, 2019

Commits on Dec 13, 2018

  1. Remove confusing comment about ideally using ! for c_void

    Using `!` for `c_void` would have the problem that pointers and
    potentially references to an uninhabited type would be created, and at
    least for references this is UB.
    
    Also document in addition that newtype wrappers around `c_void` are not
    recommended for representing opaque types (as a workaround for `extern
    type` not being stable) but instead refer to the Nomicon.
    sdroege committed Dec 13, 2018
    Configuration menu
    Copy the full SHA
    5eafae2 View commit details
    Browse the repository at this point in the history
  2. Update code comments of c_void to explain the reasoning for its cur…

    …rent implementation
    
    We need at least two variants of the enum as otherwise the compiler
    complains about the #[repr(u8)] attribute and we also need at least one
    variant as otherwise the enum would be uninhabitated and dereferencing
    pointers to it would be UB.
    
    As such, mark the variants not unstable because they should not actually
    exist but because they are temporary implementation details until
    `extern type` is stable and can be used instead.
    sdroege committed Dec 13, 2018
    Configuration menu
    Copy the full SHA
    8de8880 View commit details
    Browse the repository at this point in the history