Skip to content

require a consistent codegen backend when -Zllvm-target-feature is present - #160618

Open
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:llvm-target-feature-codegen-backends
Open

RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:llvm-target-feature-codegen-backends

Conversation

@RalfJung

@RalfJung RalfJung commented Aug 6, 2026 •

Copy link
Copy Markdown
Member

View all comments

Finishes the implementation of #157753 by ensuring that we don't mix codegen backends when using backend-specific target features (as other backends would ignore those).

r? @folkertdev
Cc @davidtwco @azhogin I hope I am using target modifiers correctly :D

@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 Aug 6, 2026
@rust-log-analyzer

This comment has been minimized.

@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from 34238f6 to 6bf460d Compare August 6, 2026 08:53
Comment thread compiler/rustc_session/src/options.rs Resolved
@rust-log-analyzer

This comment has been minimized.

@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from 6bf460d to ce5650d Compare August 6, 2026 10:20
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 7, 2026
@rust-bors

This comment has been minimized.

@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from ce5650d to 89fe5bb Compare August 17, 2026 09:28
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from 89fe5bb to ab764ef Compare August 17, 2026 14:13
@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from ab764ef to 6c38dd1 Compare August 19, 2026 15:26
@rustbot

This comment has been minimized.

@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from 6c38dd1 to c78fabd Compare August 21, 2026 18:46
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from c78fabd to d2e4e3e Compare November 9, 2026 20:12
@rustbot

rustbot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from d2e4e3e to 63b7618 Compare November 9, 2026 21:28
@RalfJung

RalfJung commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

@rustbot ready
@folkertdev should be ready to review, finally :)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 9, 2026
@rust-log-analyzer

This comment has been minimized.

@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from 63b7618 to 3d0b511 Compare November 9, 2026 21:35

let diag = format!(
"mixing target features will cause an ABI mismatch in crate `{local_crate}`"
"mixing target features may cause an ABI mismatch in crate `{local_crate}`"

@RalfJung RalfJung Nov 9, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is mostly a drive-by fix -- not all target feature mixing will cause ABI trouble, so I used "may" in the new message and updated the old one to match.

View changes since the review

@rust-log-analyzer

This comment has been minimized.

@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from 3d0b511 to 813d3b0 Compare November 9, 2026 21:45
@rustbot

rustbot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 9, 2026
@rust-log-analyzer

This comment has been minimized.

@RalfJung
RalfJung force-pushed the llvm-target-feature-codegen-backends branch from 813d3b0 to c334451 Compare November 10, 2026 07:39

@folkertdev folkertdev left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Spotted a typo in the flag name. With that fixed, r=me

View changes since this review

"mixing codegen backends while using backend-specific target features may cause an ABI mismatch in crate `{local_crate}`"
);
let mut diag = tcx.dcx().struct_err(diag);
diag.help("this crate has `-Zllvm-target-features` set, which means different codegen backends could interpret the target features differently, or ignore them entirely");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
diag.help("this crate has `-Zllvm-target-features` set, which means different codegen backends could interpret the target features differently, or ignore them entirely");
diag.help("this crate has `-Zllvm-target-feature` set, which means different codegen backends could interpret the target features differently, or ignore them entirely");

Probably grep to see if this happened anywhere else.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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