-
Notifications
You must be signed in to change notification settings - Fork 1k
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
haiku adding subset of cpu topology api. #3440
Conversation
r? @JohnTitor (rustbot has picked a reviewer for you, use r? to override) |
@bors r+ |
☀️ Test successful - checks-actions, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13, checks-cirrus-freebsd-14 |
|| self.package == other.package | ||
|| self.core == other.core | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unsound, as the fields may be uninitialized. Safe functions must not access union fields that may be uninitialized.
Cc #2816
.field("root", &self.root) | ||
.field("package", &self.package) | ||
.field("core", &self.core) | ||
.finish() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks equally unsound as it reads from potentially uninitialized fields.
B_TOPOLOGY_SMT, | ||
B_TOPOLOGY_CORE, | ||
B_TOPOLOGY_PACKAGE, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this valid? enums in Rust and C have very different semantics -- in C they are integer types and some associated constants, in Rust a value of enum type must always be one of the variants or else there is immediate UB.
The e!
macro does not even seem to add any repr
so the layout of these enums seems to be largely undefined as well.
No description provided.