Skip to content

Use copy_nonoverlapping to copy bytes in String::insert_bytes #86433

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

Merged
merged 1 commit into from
Jun 20, 2021

Conversation

paolobarbolini
Copy link
Contributor

The second copy could be made using ptr::copy_nonoverlapping instead of ptr::copy, since aliasing won't allow self and bytes to overlap. LLVM even seems to recognize this, replacing the second memmove with a memcopy, so this makes it so it's always applied.

@rust-highfive
Copy link
Contributor

r? @yaahc

(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 Jun 18, 2021
@m-ou-se m-ou-se assigned m-ou-se and unassigned yaahc Jun 19, 2021
@m-ou-se
Copy link
Member

m-ou-se commented Jun 19, 2021

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 19, 2021

📌 Commit d8530d0 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 Jun 19, 2021
@bors
Copy link
Collaborator

bors commented Jun 19, 2021

⌛ Testing commit d8530d0 with merge f639657...

@bors
Copy link
Collaborator

bors commented Jun 20, 2021

☀️ Test successful - checks-actions
Approved by: m-ou-se
Pushing f639657 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 20, 2021
@bors bors merged commit f639657 into rust-lang:master Jun 20, 2021
@rustbot rustbot added this to the 1.55.0 milestone Jun 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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