Skip to content

fix -Zmin-function-alignment on functions without attributes #142923

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

Conversation

folkertdev
Copy link
Contributor

tracking issue: #82232
related: #142854

The minimum function alignment was skipped on functions without attributes (because the logic was in a loop that only runs if there is at least one attribute). The underlying reason we didn't catch this before is that in our testing we generally apply #[no_mangle] to functions that are tested. I've added a test now that deliberately has no attributes.

r? @workingjubilee

the minimum function alignment was skipped on functions without attributes. That is because in our testing we generally apply `#[no_mangle]` to functions that are tested. I've added a test now that deliberately has no attributes
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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 Jun 23, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 23, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

Some changes occurred in compiler/rustc_codegen_ssa/src/codegen_attrs.rs

cc @jdonszelmann

@workingjubilee
Copy link
Member

Hm.

We... probably shouldn't have several hundred line loop bodies. Oh well.

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 23, 2025

📌 Commit 8147646 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 23, 2025
bors added a commit that referenced this pull request Jun 24, 2025
Rollup of 9 pull requests

Successful merges:

 - #140985 (Change `core::iter::Fuse`'s `Default` impl to do what its docs say it does)
 - #141324 (std: sys: random: uefi: Provide rdrand based fallback)
 - #142134 (Reject unsupported `extern "{abi}"`s consistently in all positions)
 - #142784 (Add codegen timing section)
 - #142827 (Move error code explanation removal check into tidy)
 - #142873 (Don't suggest changing a  method inside a expansion)
 - #142908 (Fix install-template.sh for Solaris tr)
 - #142922 (Fix comment on NoMangle)
 - #142923 (fix `-Zmin-function-alignment` on functions without attributes)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b7a9cd8 into rust-lang:master Jun 24, 2025
10 checks passed
rust-timer added a commit that referenced this pull request Jun 24, 2025
Rollup merge of #142923 - folkertdev:min-function-alignment-no-attributes, r=workingjubilee

fix `-Zmin-function-alignment` on functions without attributes

tracking issue: #82232
related: #142854

The minimum function alignment was skipped on functions without attributes (because the logic was in a loop that only runs if there is at least one attribute). The underlying reason we didn't catch this before is that in our testing we generally apply `#[no_mangle]` to functions that are tested. I've added a test now that deliberately has no attributes.

r? `@workingjubilee`
@rustbot rustbot added this to the 1.90.0 milestone Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

4 participants