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

Fixes for align_offset #957

Merged
merged 5 commits into from
Sep 28, 2019
Merged

Fixes for align_offset #957

merged 5 commits into from
Sep 28, 2019

Conversation

pvdrz
Copy link
Contributor

@pvdrz pvdrz commented Sep 17, 2019

This addresses @RalfJung's comments in #945

src/shims/mod.rs Outdated Show resolved Hide resolved
src/shims/mod.rs Outdated Show resolved Hide resolved
src/shims/mod.rs Outdated Show resolved Hide resolved
@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
Member

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Sep 28, 2019

📌 Commit e2c54e6 has been approved by RalfJung

@bors
Copy link
Contributor

bors commented Sep 28, 2019

⌛ 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
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
Copy link
Contributor

bors commented Sep 28, 2019

☀️ 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
Copy link
Contributor Author

pvdrz commented Sep 28, 2019 via email

@RalfJung
Copy link
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
Copy link
Contributor Author

pvdrz commented Sep 28, 2019 via email

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