Skip to content

fix: Handle multiple #[repr(..)] attrs correctly #19416

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

Merged
merged 1 commit into from
Mar 22, 2025

Conversation

ShoyuVanilla
Copy link
Member

Fixes #15037

In codes like the following cases:

#[repr(X)]
#[repr(Y)]
#[repr(Z)]
struct Foo { .. }

we've been using only the first #[repr(X)] attribute on struct, but we should handle them like #[repr(X, Y, Z)]

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 22, 2025
*int = other.int;
}
}

fn parse_repr_tt(tt: &crate::tt::TopSubtree) -> Option<ReprOptions> {
Copy link
Member Author

@ShoyuVanilla ShoyuVanilla Mar 22, 2025

Choose a reason for hiding this comment

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

Diffs inside this function are not necessary but I think that using the above fn merge_repr would be better in consistency.

@@ -24,9 +24,6 @@ extern crate rustc_hashes;
#[cfg(not(feature = "in-rust-tree"))]
extern crate ra_ap_rustc_abi as rustc_abi;

#[cfg(not(feature = "in-rust-tree"))]
extern crate ra_ap_rustc_hashes as rustc_hashes;

Copy link
Member Author

Choose a reason for hiding this comment

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

We've been using this for rustc_hashes::Hash64::ZERO but it is replaced with Default::default() in this PR

@Veykril Veykril added this pull request to the merge queue Mar 22, 2025
@Veykril
Copy link
Member

Veykril commented Mar 22, 2025

Thanks!

Merged via the queue into rust-lang:master with commit 2e5e511 Mar 22, 2025
9 checks passed
@ShoyuVanilla ShoyuVanilla deleted the issue-15037 branch March 23, 2025 01:49
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Layout info of #[repr(C)] #[repr(packed)] struct is wrong
3 participants