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

Manually implement extra traits for mq_attr and sockaddr_nl #1371

Merged
merged 2 commits into from
May 27, 2019

Conversation

Susurrus
Copy link
Contributor

@Susurrus Susurrus commented May 27, 2019

Avoid including padding fields in extra trait implementations as these fields aren't guaranteed to be 0 or some other sensible value.

Closes #1302

The `pad` or `__reserved`  fields are not always 0 on some platforms,
so when used in the `PartialEq` implementation being used, fails some
comparisons. This commit manually implements the extra traits to
correct this behavior.
`nl_pad` field does not contain any actual data, so using it for
comparison or hashing doesn't make sense. Instead manually implement
extra traits ignoring this field.
@rust-highfive
Copy link

r? @gnzlbg

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

@Susurrus
Copy link
Contributor Author

cc @asomers

@Susurrus Susurrus changed the title Manuall implement extra traits for mq_attr and sockaddr_nl Manually implement extra traits for mq_attr and sockaddr_nl May 27, 2019
Copy link
Contributor

@asomers asomers left a comment

Choose a reason for hiding this comment

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

LGTM!

@gnzlbg
Copy link
Contributor

gnzlbg commented May 27, 2019

@bors: r+


We should probably just use "special" padding types that derive trivial implementations of the traits (e.g. PartialEq always returns true, hashing does nothing, debug does not display anything, etc.).

@bors
Copy link
Contributor

bors commented May 27, 2019

📌 Commit 0b34501 has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented May 27, 2019

⌛ Testing commit 0b34501 with merge b53c8b2...

bors added a commit that referenced this pull request May 27, 2019
Manually implement extra traits for `mq_attr` and `sockaddr_nl`

Avoid including padding fields in extra trait implementations as these fields aren't guaranteed to be 0 or some other sensible value.

Closes #1302
@bors
Copy link
Contributor

bors commented May 27, 2019

💡 This pull request was already approved, no need to approve it again.

  • This pull request is currently being tested. If there's no response from the continuous integration service, you may use retry to trigger a build again.

@bors
Copy link
Contributor

bors commented May 27, 2019

📌 Commit 0b34501 has been approved by gnzlbg

bors added a commit that referenced this pull request May 27, 2019
Manually implement extra traits for `mq_attr` and `sockaddr_nl`

Avoid including padding fields in extra trait implementations as these fields aren't guaranteed to be 0 or some other sensible value.

Closes #1302
@bors
Copy link
Contributor

bors commented May 27, 2019

⌛ Testing commit 0b34501 with merge 9931d3b...

@bors
Copy link
Contributor

bors commented May 27, 2019

💔 Test failed - checks-travis

@gnzlbg
Copy link
Contributor

gnzlbg commented May 27, 2019

@bors: retry

@bors
Copy link
Contributor

bors commented May 27, 2019

⌛ Testing commit 0b34501 with merge 8e2e498...

bors added a commit that referenced this pull request May 27, 2019
Manually implement extra traits for `mq_attr` and `sockaddr_nl`

Avoid including padding fields in extra trait implementations as these fields aren't guaranteed to be 0 or some other sensible value.

Closes #1302
@bors
Copy link
Contributor

bors commented May 27, 2019

💔 Test failed - checks-cirrus-freebsd-11

@bors
Copy link
Contributor

bors commented May 27, 2019

☀️ Test successful - checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-travis, status-appveyor
Approved by: gnzlbg
Pushing 8e2e498 to master...

@bors bors merged commit 0b34501 into rust-lang:master May 27, 2019
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.

mq_attr checks __reserved and pad fields in PartialEq comparison
5 participants