Skip to content

codegen: Generate u128 / i128 when available.#1391

Merged
bors-servo merged 5 commits into
rust-lang:masterfrom
emilio:u128
Sep 19, 2018
Merged

codegen: Generate u128 / i128 when available.#1391
bors-servo merged 5 commits into
rust-lang:masterfrom
emilio:u128

Conversation

@emilio

@emilio emilio commented Sep 19, 2018

Copy link
Copy Markdown
Contributor

This is the first step to fix #1370 / #1338 / etc.

Fix for that will build up on this.

@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@emilio

emilio commented Sep 19, 2018

Copy link
Copy Markdown
Contributor Author

I implemented the whole thing, but there's an autogenerated test failure that fails because of rust-lang/rust#54341.

So i128 / u128 doesn't have the right alignment on Rust :(

@emilio

emilio commented Sep 19, 2018

Copy link
Copy Markdown
Contributor Author

Still I think it's an improvement over what we have... So if I were to land this I'd disable the autogenerated tests for that test.

r? @fitzgen

To work-around some cases of rust-lang/rust#54341.

Other cases where u128 and u64 are mixed in fields might not behave correctly,
but the field offset assertions would catch them.

Fixes rust-lang#1370
@emilio

emilio commented Sep 19, 2018

Copy link
Copy Markdown
Contributor Author

Yeah, so I fixed it kind of, by always forcing repr(align) for such alignments. That makes all tests pass.

@fitzgen fitzgen left a comment

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.

LGTM!

Would be valuable to have test coverage for the blob bits by making a test with a struct that contains a __int128 that is marked as opaque.

@emilio

emilio commented Sep 19, 2018

Copy link
Copy Markdown
Contributor Author

The blob bits unfortunately aren't an improvement over what we have because of that rust alignment issue, so I don't think we can land tests for them unless we have a way of expecting test failures, which I don't think I have the cycles for.

Thanks for the review!

@bors-servo r=fitzgen

@bors-servo

Copy link
Copy Markdown

📌 Commit c09c74e has been approved by fitzgen

@bors-servo

Copy link
Copy Markdown

⌛ Testing commit c09c74e with merge 6fc0a31...

bors-servo pushed a commit that referenced this pull request Sep 19, 2018
codegen: Generate u128 / i128 when available.

This is the first step to fix #1370 / #1338 / etc.

Fix for that will build up on this.
@bors-servo

Copy link
Copy Markdown

☀️ Test successful - status-travis
Approved by: fitzgen
Pushing 6fc0a31 to master...

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.

Auto-generated test failure using <link.h> on Debian 9.

4 participants