Skip to content

Commit

Permalink
Auto merge of #113859 - Manishearth:vec-as-mut-ptr-stacked-borrow, r=…
Browse files Browse the repository at this point in the history
…dtolnay

Add note that Vec::as_mut_ptr() does not materialize a reference to the internal buffer

See discussion on thomcc/rust-typed-arena#62 and [t-opsem](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/is.20this.20typed_arena.20code.20sound.20under.20stacked.2Ftree.20borrows.3F)

This method already does the correct thing here, but it is worth guaranteeing that it does so it can be used more freely in unsafe code without having to worry about potential Stacked/Tree Borrows violations. This moves one more unsafe usage pattern from the "very likely sound but technically not fully defined" box into "definitely sound", and currently our surface area of the latter is woefully small.

I'm not sure how best to word this, opening this PR as a way to start discussion.
  • Loading branch information
bors committed Aug 29, 2023
2 parents f694f07 + 39196ed commit dcb9e2d
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit dcb9e2d

Please sign in to comment.