Skip to content

Conversation

RalfJung
Copy link
Member

As discussed here.

@rustbot
Copy link
Collaborator

rustbot commented Aug 24, 2023

r? @b-naber

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 24, 2023
@RalfJung RalfJung force-pushed the no-in-place-packed branch from 36e3782 to c3dd437 Compare August 24, 2023 09:36
let mut has_duplicates = false;
for arg in args {
if let Operand::Move(place) = arg {
has_duplicates |= !self.place_cache.insert(place.as_ref());
if is_within_packed(self.tcx, &self.body.local_decls, *place).is_some() {
Copy link
Member Author

@RalfJung RalfJung Aug 24, 2023

Choose a reason for hiding this comment

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

@cjgillot right now this is more strict than your check in #115138. Your pass might introduce move of packed fields if the field happens to not require more alignment anyway (such as a u8 in a packed struct). However determining that requires a param_env and then I'd have to move this check into the TypeChecker... is it really worth allowing such moves?

Copy link
Contributor

Choose a reason for hiding this comment

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

My patch uses is_disaligned for simplicity. No objection to using is_with_packed: as simple and more secure.

@b-naber
Copy link
Contributor

b-naber commented Aug 28, 2023

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 28, 2023

📌 Commit 739144f has been approved by b-naber

It is now in the queue for this repository.

@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 Aug 28, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 28, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#115164 (MIR validation: reject in-place argument/return for packed fields)
 - rust-lang#115240 (codegen_llvm/llvm_type: avoid matching on the Rust type)
 - rust-lang#115294 (More precisely detect cycle errors from type_of on opaque)
 - rust-lang#115310 (Document panic behavior across editions, and improve xrefs)
 - rust-lang#115311 (Revert "Suggest using `Arc` on `!Send`/`!Sync` types")
 - rust-lang#115317 (Devacationize oli-obk)
 - rust-lang#115319 (don't use SnapshotVec in Graph implementation, as it looks unused; use Vec instead)
 - rust-lang#115322 (Tweak output of `to_pretty_impl_header` involving only anon lifetimes)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 88b476c into rust-lang:master Aug 28, 2023
@rustbot rustbot added this to the 1.74.0 milestone Aug 28, 2023
@RalfJung RalfJung deleted the no-in-place-packed branch August 29, 2023 06:15
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants