Skip to content

Fixes for align_offset#957

Merged
bors merged 5 commits into
rust-lang:masterfrom
pvdrz:ptr-align-offset
Sep 28, 2019
Merged

Fixes for align_offset#957
bors merged 5 commits into
rust-lang:masterfrom
pvdrz:ptr-align-offset

Conversation

@pvdrz

@pvdrz pvdrz commented Sep 17, 2019

Copy link
Copy Markdown
Contributor

This addresses @RalfJung's comments in #945

Comment thread src/shims/mod.rs Outdated
Comment thread src/shims/mod.rs Outdated
Comment thread src/shims/mod.rs Outdated
@pvdrz pvdrz requested a review from RalfJung September 23, 2019 02:51
@pvdrz pvdrz changed the title Allow align_offset for integers Fixes for align_offset Sep 24, 2019
@RalfJung

Copy link
Copy Markdown
Member

Thanks!

@bors r+

@bors

bors commented Sep 28, 2019

Copy link
Copy Markdown
Contributor

📌 Commit e2c54e6 has been approved by RalfJung

@bors

bors commented Sep 28, 2019

Copy link
Copy Markdown
Contributor

⌛ Testing commit e2c54e6 with merge b625812...

bors added a commit that referenced this pull request Sep 28, 2019
Fixes for align_offset

This addresses @RalfJung's comments in #945
unsafe { x.set_len(N) };
let vec = vec![0x4141414141414141u64; N];
let content = unsafe { std::slice::from_raw_parts(vec.as_ptr() as *const u8, 8 * N) };
println!("{:?}", std::str::from_utf8(content).unwrap());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we also have a more direct test that immediately calls align_offset? That seems useful to have.

@bors

bors commented Sep 28, 2019

Copy link
Copy Markdown
Contributor

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

@bors bors merged commit e2c54e6 into rust-lang:master Sep 28, 2019
@bors bors mentioned this pull request Sep 28, 2019
@pvdrz

pvdrz commented Sep 28, 2019 via email

Copy link
Copy Markdown
Contributor Author

@RalfJung

Copy link
Copy Markdown
Member

I don't see how that relates?

We could have something that creates a Box<[u32; 4]> (should be 4-aligned on all platforms) and plays around with it a bit, like aligning some pointers in there to various alignments and see that they all behave as expected.

@pvdrz

pvdrz commented Sep 28, 2019 via email

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants