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

Deprecate Read::initializer in favor of ptr::freeze #58363

Closed
wants to merge 11 commits into from

Commits on Feb 10, 2019

  1. Deprecate Read::initializer in favor of ptr::freeze

    Read implementations should only write into the buffer passed to them,
    but have the ability to read from it. Access of uninitialized memory can
    easily cause UB, so there's then a question of what a user of a reader
    should do to initialize buffers.
    
    Previously, we allowed a Read implementation to promise it wouldn't look
    at the contents of the buffer, which allows the user to pass
    uninitialized memory to it.
    
    Instead, this PR adds a method to "freeze" undefined bytes into
    arbitrary-but-defined bytes. This is currently done via an inline
    assembly directive noting the address as an output, so LLVM no longer
    knows it's uninitialized. There is a proposed "freeze" operation in LLVM
    itself that would do this directly, but it hasn't been fully
    implemented.
    
    Some targets don't support inline assembly, so there we instead pass the
    pointer to an extern "C" function, which is similarly opaque to LLVM.
    
    The current approach is very low level. If we stabilize, we'll probably
    want to add something like `slice.freeze()` to make this easier to use.
    sfackler committed Feb 10, 2019
    Configuration menu
    Copy the full SHA
    5e0fb23 View commit details
    Browse the repository at this point in the history

Commits on Feb 11, 2019

  1. Update src/libcore/ptr.rs

    Co-Authored-By: sfackler <[email protected]>
    Centril and sfackler authored Feb 11, 2019
    Configuration menu
    Copy the full SHA
    c21e79e View commit details
    Browse the repository at this point in the history
  2. Doc cleanup

    sfackler committed Feb 11, 2019
    Configuration menu
    Copy the full SHA
    e4d316e View commit details
    Browse the repository at this point in the history

Commits on Feb 13, 2019

  1. Configuration menu
    Copy the full SHA
    73133ee View commit details
    Browse the repository at this point in the history
  2. Tweak example

    sfackler committed Feb 13, 2019
    Configuration menu
    Copy the full SHA
    1671e90 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0529921 View commit details
    Browse the repository at this point in the history
  4. Update src/libcore/ptr.rs

    Co-Authored-By: sfackler <[email protected]>
    shepmaster and sfackler authored Feb 13, 2019
    Configuration menu
    Copy the full SHA
    695feb1 View commit details
    Browse the repository at this point in the history
  5. Update src/libcore/ptr.rs

    Co-Authored-By: sfackler <[email protected]>
    shepmaster and sfackler authored Feb 13, 2019
    Configuration menu
    Copy the full SHA
    9d4f07e View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2019

  1. Configuration menu
    Copy the full SHA
    055bcb6 View commit details
    Browse the repository at this point in the history
  2. Clean up array freeze args

    sfackler committed Feb 14, 2019
    Configuration menu
    Copy the full SHA
    78e2233 View commit details
    Browse the repository at this point in the history
  3. Update src/libcore/intrinsics.rs

    Co-Authored-By: sfackler <[email protected]>
    Centril and sfackler authored Feb 14, 2019
    Configuration menu
    Copy the full SHA
    ec682d1 View commit details
    Browse the repository at this point in the history