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

Add StatementKind::CopyNonOverlapping #77511

Merged
merged 10 commits into from
Mar 10, 2021
Merged

Conversation

JulianKnodt
Copy link
Contributor

@JulianKnodt JulianKnodt commented Oct 3, 2020

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 3, 2020
@JulianKnodt JulianKnodt marked this pull request as draft October 3, 2020 21:34
compiler/rustc_middle/src/mir/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_codegen_ssa/src/mir/statement.rs Outdated Show resolved Hide resolved
@JulianKnodt
Copy link
Contributor Author

I've added placeholders to match statements on StatementKind, I'm not really sure how to properly implement most of them, but I put in some best guesses in some spots.

@bors
Copy link
Contributor

bors commented Oct 9, 2020

☔ The latest upstream changes (presumably #77747) made this pull request unmergeable. Please resolve the merge conflicts.

Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

compiler/rustc_middle/src/mir/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_codegen_ssa/src/mir/statement.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/mir/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/mir/visit.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/mir/visit.rs Outdated Show resolved Hide resolved
compiler/rustc_mir/src/borrow_check/invalidation.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented Nov 6, 2020

☔ The latest upstream changes (presumably #78267) made this pull request unmergeable. Please resolve the merge conflicts.

Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

@nagisa nagisa added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 9, 2020
@JulianKnodt
Copy link
Contributor Author

Sorry for the extremely long delay, for some reason I thought this was blocked on something, my bad

@JulianKnodt JulianKnodt force-pushed the st_kind_cpy branch 3 times, most recently from 31a543e to 318b63f Compare January 3, 2021 01:02
@nagisa
Copy link
Member

nagisa commented Jan 3, 2021

I thought this was blocked on something, my bad

At this point I'm just waiting for this to become non-WIP/non-draft before reviewing further. It seemed fairly complete last time I looked at the code changes proposed here.

@JulianKnodt JulianKnodt marked this pull request as ready for review January 4, 2021 01:15
@JulianKnodt JulianKnodt changed the title [WIP] Add StatementKind::CopyNonOverlapping Add StatementKind::CopyNonOverlapping Jan 4, 2021
@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 19, 2021
compiler/rustc_codegen_ssa/src/mir/statement.rs Outdated Show resolved Hide resolved
compiler/rustc_mir/src/borrow_check/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_mir/src/borrow_check/invalidation.rs Outdated Show resolved Hide resolved
compiler/rustc_mir/src/borrow_check/type_check/mod.rs Outdated Show resolved Hide resolved
This updates all places where match branches check on StatementKind or UseContext.
This doesn't properly implement them, but adds TODOs where they are, and also adds some best
guesses to what they should be in some cases.
Changed to various implementations, copying the style of prior function calls in places I was
unsure of.

Also one minor style nit.
Fixes copy_non_overlapping codegen_ssa to properly handle pointees,
and use bytes instead of elem count
This replaces where it was previously being constructed in intrinsics, with direct construction
of the Statement.
It was suggested to lower this in MIR instead of ssa, so do that instead.
@JulianKnodt
Copy link
Contributor Author

@rustbot label: +S-waiting-on-review -S-waiting-on-author

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 9, 2021
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

👍 for the interpreter changes modulo the nit I raised. Thanks a lot :)

Also add some span_bugs where it is unreachable
@wesleywiser
Copy link
Member

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Mar 9, 2021

📌 Commit 4bceb29 has been approved by oli-obk

@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 Mar 9, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 10, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#77511 (Add StatementKind::CopyNonOverlapping)
 - rust-lang#79208 (Stabilize `unsafe_op_in_unsafe_fn` lint)
 - rust-lang#82411 (Fixes to ExitStatus and its docs)
 - rust-lang#82733 (Add powerpc-unknown-openbsd target)
 - rust-lang#82802 (Build rustdoc for run-make tests, not just run-make-fulldeps)
 - rust-lang#82849 (Add Option::get_or_default)
 - rust-lang#82908 (:arrow_up: rust-analyzer)
 - rust-lang#82937 (Update README.md to use the correct cmake version number)
 - rust-lang#82938 (Bump tracing-tree dependency)
 - rust-lang#82942 (Don't hardcode the `v1` prelude in diagnostics, to allow for new preludes.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 25fd504 into rust-lang:master Mar 10, 2021
@rustbot rustbot added this to the 1.52.0 milestone Mar 10, 2021
@JulianKnodt JulianKnodt deleted the st_kind_cpy branch March 10, 2021 04:22
self.memory.check_ptr_access(self.read_scalar(&src)?.check_init()?, size, align)?;

let dst =
self.memory.check_ptr_access(self.read_scalar(&dst)?.check_init()?, size, align)?;
Copy link
Member

Choose a reason for hiding this comment

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

I just noticed that this is wrong -- the size used for the access check here needs to be the full size, already multiplied with the count!

I'll submit a PR.

Copy link
Member

Choose a reason for hiding this comment

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

Done: #82967

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 10, 2021
fix copy_nonoverlapping

Fixes a bug introduced by rust-lang#77511

r? `@oli-obk`
Fixes rust-lang#82961
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 10, 2021
…-obk

fix error message for copy(_nonoverlapping) overflow

Fixes an error message regression introduced in rust-lang#77511 (and adds tests).

r? `@oli-obk`
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.