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

fix various aliasing issues in the standard library #78602

Merged
merged 4 commits into from
Nov 1, 2020

Conversation

RalfJung
Copy link
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
Collaborator

r? @LukasKalbertodt

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 31, 2020
}

/// Gets a mutable pointer to the first element of the array.
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
#[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
Member Author

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
Member

m-ou-se commented Nov 1, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Nov 1, 2020

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

@bors bors 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-se m-ou-se assigned m-ou-se and unassigned LukasKalbertodt 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:master Nov 1, 2020
@rustbot rustbot 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: 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