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

Vec drop and truncate: drop using raw slice *mut [T] #71148

Merged
merged 2 commits into from
May 1, 2020

Commits on Apr 14, 2020

  1. Vec drop and truncate: drop using raw slice *mut [T]

    By creating a *mut [T] directly (without going through &mut [T]), avoid
    questions of validity of the contents of the slice.
    
    Consider the following risky code:
    
    ```rust
    unsafe {
        let mut v = Vec::<bool>::with_capacity(16);
        v.set_len(16);
    }
    ```
    
    The intention is that with this change, the above snippet will be
    sound because Vec::drop does no longer produces a mutable slice of
    the vector's contents.
    bluss committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    7612ad7 View commit details
    Browse the repository at this point in the history

Commits on Apr 28, 2020

  1. Vec IntoIter: Drop using raw slice

    Update Vec drop with a comment to explain why we want to use a raw
    slice, and extend this pattern to also include the Vec's IntoIter.
    bluss committed Apr 28, 2020
    Configuration menu
    Copy the full SHA
    f654daf View commit details
    Browse the repository at this point in the history