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

haiku adding subset of cpu topology api. #3440

Merged
merged 1 commit into from Nov 14, 2023

Conversation

devnexen
Copy link
Contributor

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Nov 12, 2023

r? @JohnTitor

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

@JohnTitor
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 14, 2023

📌 Commit e15d0f9 has been approved by JohnTitor

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Nov 14, 2023

⌛ Testing commit e15d0f9 with merge 1ab1874...

@bors
Copy link
Contributor

bors commented Nov 14, 2023

☀️ Test successful - checks-actions, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13, checks-cirrus-freebsd-14
Approved by: JohnTitor
Pushing 1ab1874 to main...

@bors bors merged commit 1ab1874 into rust-lang:main Nov 14, 2023
11 checks passed
|| self.package == other.package
|| self.core == other.core
}
}
Copy link
Member

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()
Copy link
Member

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,
}
Copy link
Member

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.

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

Successfully merging this pull request may close these issues.

None yet

5 participants