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

Stacked Borrows: alignment does not matter #1348

Merged
merged 2 commits into from
Apr 22, 2020

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Apr 18, 2020

Fixes #1339
Requires rust-lang/rust#71280

// updated using "self.0 = ..." (can happen in Box::from_raw); see miri#1050.
let place = this.mplace_access_checked(place)?;
// updated using "self.0 = ..." (can happen in Box::from_raw) so we cannot ICE; see miri#1050.
let place = this.mplace_access_checked(place, Some(Align::from_bytes(1).unwrap()))?;
Copy link
Contributor

@oli-obk oli-obk Apr 22, 2020

Choose a reason for hiding this comment

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

you could also just mutate the layout here before passing the place to mplace_access_checked instead of having to change the API.

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean, change the value of place.layout.align? That feels even more hacky than the API extension...
Also that could trigger the assertion in mplace_access_checked.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 22, 2020
Miri: mplace_access_checked: offer option to force different alignment on place

Required to solve rust-lang/miri#1339 in rust-lang/miri#1348.

r? @oli-obk
@RalfJung
Copy link
Member Author

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 22, 2020

📌 Commit 4b9abda has been approved by RalfJung

@bors
Copy link
Collaborator

bors commented Apr 22, 2020

⌛ Testing commit 4b9abda with merge 26baf87...

@bors
Copy link
Collaborator

bors commented Apr 22, 2020

☀️ Test successful - checks-travis, status-appveyor
Approved by: RalfJung
Pushing 26baf87 to master...

@bors bors merged commit 26baf87 into rust-lang:master Apr 22, 2020
@RalfJung RalfJung deleted the raw-addr-of-align branch April 22, 2020 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked-on-rust Status: Blocked on landing a Rust PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unaligned raw references are considered UB
3 participants