Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • rust
  • kernel
  • types.rs
Find file BlameHistoryPermalink
  • Alice Ryhl's avatar
    rust: make `UnsafeCell` the outer type in `Opaque` · 35cad617
    Alice Ryhl authored Jun 14, 2023
    
    
    When combining `UnsafeCell` with `MaybeUninit`, it is idiomatic to use
    `UnsafeCell` as the outer type. Intuitively, this is because a
    `MaybeUninit<T>` might not contain a `T`, but we always want the effect
    of the `UnsafeCell`, even if the inner value is uninitialized.
    
    Now, strictly speaking, this doesn't really make a difference. The
    compiler will always apply the `UnsafeCell` effect even if the inner
    value is uninitialized. But I think we should follow the convention
    here.
    
    Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
    Reviewed-by: default avatarBenno Lossin <benno.lossin@proton.me>
    Reviewed-by: default avatarGary Guo <gary@garyguo.net>
    Reviewed-by: default avatarMartin Rodriguez Reboredo <yakoyoku@gmail.com>
    Link: https://lore.kernel.org/r/20230614115328.2825961-1-aliceryhl@google.com
    
    
    Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
    35cad617
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7