Skip to content

fix various aliasing issues in the standard library - #78602

Merged
bors merged 4 commits into
rust-lang:masterfrom
RalfJung:raw-ptr-aliasing-issues
Nov 1, 2020
Merged

fix various aliasing issues in the standard library#78602
bors merged 4 commits into
rust-lang:masterfrom
RalfJung:raw-ptr-aliasing-issues

Conversation

@RalfJung

Copy link
Copy Markdown
Member

This fixes various cases where the standard library either used raw pointers after they were already invalidated by using the original reference again, or created raw pointers for one element of a slice and used it to access neighboring elements.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @LukasKalbertodt

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 31, 2020
#[inline(always)]
pub fn slice_as_mut_ptr(this: &mut [MaybeUninit<T>]) -> *mut T {
this as *mut [MaybeUninit<T>] as *mut T
this.as_mut_ptr() as *mut T

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a bugfix but just a stylistic improvement.

@m-ou-se

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Nov 1, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 9749eb7 has been approved by m-ou-se

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 1, 2020
@m-ou-sem-ou-se mentioned this pull request Nov 1, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 1, 2020
Rollup of 6 pull requests
Successful merges:
- rust-lang#78073 (Add #[inline] to some functions in core::str.)
- rust-lang#78596 (Fix doc links to std::fmt)
- rust-lang#78599 (Add note to process::arg[s] that args shouldn't be escaped or quoted)
- rust-lang#78602 (fix various aliasing issues in the standard library)
- rust-lang#78603 (expand: Tweak a comment in implementation of `macro_rules`)
- rust-lang#78621 (Inline Default::default() for atomics)
Failed merges:
r? `@ghost`
@bors
bors merged commit 8ed31d2 into rust-lang:masterNov 1, 2020
@rustbotrustbot added this to the 1.49.0 milestone Nov 1, 2020
@RalfJung
RalfJung deleted the raw-ptr-aliasing-issues branch November 2, 2020 17:50
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@RalfJung@rust-highfive@m-ou-se@bors@LukasKalbertodt@rustbot