about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm
diff options
context:
space:
mode:
authorUlrik Sverdrup <bluss@users.noreply.github.com>2020-04-14 21:35:37 +0200
committerUlrik Sverdrup <bluss@users.noreply.github.com>2020-04-14 21:51:48 +0200
commit7612ad77975331c91aec8ab2a269b31b22668972 (patch)
treec4c4b7f023a65c6617e31dc4bcda948d7a9fb912 /src/test/codegen/src-hash-algorithm
parent6805906fba0bca2bc77da9ad09cc9f91c3cea3eb (diff)
downloadrust-7612ad77975331c91aec8ab2a269b31b22668972.tar.gz
rust-7612ad77975331c91aec8ab2a269b31b22668972.zip
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.
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions