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

Clean the LLVM wrapper #135502

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

dpaoliello
Copy link
Contributor

This change sets the visibility for LLVM wrapper FFI items to pub(crate), which allows Rust's dead code lints to flag unused parts of the LLVM wrapper.

@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 14, 2025
@klensy
Copy link
Contributor

klensy commented Jan 14, 2025

cc @Zalathar #134009

Comment on lines -173 to -176
pub enum UnnamedAddr {
No,
Local,
Global,
Copy link
Contributor

Choose a reason for hiding this comment

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

For enums that are passed across FFI to C/C++ code, we shouldn't delete Rust-side variants that are unused.

Doing so just makes it harder to verify that the Rust-side enum and the C-side enum have the same layout, which is essential for soundness.

Default,
Gnu,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is another case where removing unused enum variants is a net negative. It just makes auditing harder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, it was removed from both the Rust and C++ side: would you rather that I add it back to both?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, please add it back to both.

(Our LLVMRustDebugNameTableKind enum is basically just a substitute for LLVM's DICompileUnit::DebugNameTableKind. It's needed to work around the fact that we can't reliably pass LLVM's C++ enums across FFI, because the LLVM C++ API isn't stable, so upgrading LLVM would potentially introduce silent UB if the enums change incompatibly.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@Zalathar
Copy link
Contributor

(There's more review I want to do here, but unfortunately GitHub has decided that trying to add a review comment should now hang the browser for several seconds, so the review interface is more-or-less unusable right now.)

@klensy
Copy link
Contributor

klensy commented Jan 15, 2025

I've tried some of this cleanup in #127274, so some review comments from it can be used here as well.

@dpaoliello
Copy link
Contributor Author

I've tried some of this cleanup in #127274, so some review comments from it can be used here as well.

Good call:

@workingjubilee
Copy link
Member

Yes, removing the tail call stuff is fine, as you said it is a trivial revert.

@lcnr
Copy link
Contributor

lcnr commented Jan 21, 2025

r? @Zalathar as you're already reviewing this PR 🤔 feel free to reassign

@rustbot rustbot assigned Zalathar and unassigned lcnr Jan 21, 2025
@bors
Copy link
Contributor

bors commented Jan 21, 2025

☔ The latest upstream changes (presumably #135335) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants