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

std: Update documentation of seek_write on Windows #120452

Merged
merged 1 commit into from
Jan 30, 2024

Commits on Jan 28, 2024

  1. std: Update documentation of seek_write on Windows

    Currently the documentation of `FileExt::seek_write` on Windows
    indicates that writes beyond the end of the file leave intermediate
    bytes uninitialized. This commentary dates back to the original
    inclusion of these functions in rust-lang#35704 (wow blast from the past!). At
    the time the functionality here was implemented using `WriteFile`, but
    nowadays the `NtWriteFile` method is used instead. The documentation for
    `NtWriteFile` explicitly states:
    
    > If Length and ByteOffset specify a write operation past the current
    > end-of-file mark, NtWriteFile automatically extends the file and updates
    > the end-of-file mark; any bytes that are not explicitly written between
    > such old and new end-of-file marks are defined to be zero.
    
    This commentary has had a downstream impact in the `system-interface`
    crate where it tries to handle this by explicitly writing zeros, but I
    don't believe that's necessary any more. I'm sending a PR upstream here
    to avoid future confusion and codify that zeros are written in the
    intermediate bytes matching what Windows currently provides.
    alexcrichton committed Jan 28, 2024
    Configuration menu
    Copy the full SHA
    b85b2a7 View commit details
    Browse the repository at this point in the history