Skip to content

make -Zmin-function-alignment a target modifier #143323

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

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

Conversation

folkertdev
Copy link
Contributor

tracking issue: #82232
cc #136966 #142824

Make -Zmin-function-alignment a target modifier, as discussed in #136966. This change effectively broadens the definition of what a target modifier can be: combining crates with different values of this flag has no risk of creating UB (so far), but it is logically inconsistent.

It is still up in the air whether the alignment provided by this flag will be a language guarantee.

r? @workingjubilee

@rustbot
Copy link
Collaborator

rustbot commented Jul 2, 2025

workingjubilee is currently at their maximum review capacity.
They may take a while to respond.

@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 Jul 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 2, 2025

The Miri subtree was changed

cc @rust-lang/miri

@@ -0,0 +1,13 @@
error: mixing `-Zmin-function-alignment` will cause an ABI mismatch in crate `incompatible_min_function_alignment`
Copy link
Member

@jieyouxu jieyouxu Jul 3, 2025

Choose a reason for hiding this comment

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

Discussion: when this isn't a language guarantee, it's almost like this should be a warning/warn-by-default lint and not an error, right?

the -Zmin-function-alignment flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely

When this is a hint, then the current target modifier infra/error message might be a bit confusing

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.
4 participants