Skip to content

Conversation

@bjorn3
Copy link
Member

@bjorn3 bjorn3 commented May 19, 2025

Rather than just builtin codegen backends. This is perma-unstable on the rustc side, but is useful to enable a codegen backend built separately from rustc to be used without overwriting RUSTFLAGS as well as to allow configuring the codegen backend on a per-package basis.

Rather than just builtin codegen backends. This is perma-unstable on the
rustc side, but is useful to enable a codegen backend built separately
from rustc to be used without overwriting RUSTFLAGS as well as to allow
configuring the codegen backend on a per-package basis.
@rustbot
Copy link
Collaborator

rustbot commented May 19, 2025

r? @ehuss

rustbot has assigned @ehuss.
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 A-manifest Area: Cargo.toml issues S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 19, 2025
name,
codegen_backend,
);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

If preferred I can also keep this check on the cargo side when nightly features are disabled.

Copy link
Member

Choose a reason for hiding this comment

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

How arbitrary you'd like to have for codegen-backend name? What is the real use case here?

The change seems fine to me though, as a nightly feature.

Copy link
Member Author

Choose a reason for hiding this comment

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

Basically -Zcodegen-backend allows either of the following:

  • The name of a builtin codegen backend. This will eventually be stabilized once one of the non-LLVM backends gets stabilized.
  • The full path to a dylib implementing a codegen backend. This will never be stable. It exists to allow codegen backends not shipped as part of rustc to be used. For example cg_clif uses it when you locally build it or when using the version from its CI rather than the rustup distributed version (the CI version is newer). Same for cg_gcc when you locally build it.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the info! It makes sense to relax it a bit for now.

When stabilization, Cargo should only allow a set of known backends. We should track it somewhere, though we dont really have a Cargo tracking issue for codegen-backend right now.

Copy link
Member

Choose a reason for hiding this comment

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

@weihanglo weihanglo added this pull request to the merge queue May 19, 2025
Merged via the queue into rust-lang:master with commit a466cc5 May 19, 2025
23 checks passed
@bjorn3 bjorn3 deleted the codegen_backend_arbitrary_path branch May 19, 2025 17:14
bors added a commit to rust-lang/rust that referenced this pull request May 23, 2025
Update cargo

9 commits in 47c911e9e6f6461f90ce19142031fe16876a3b95..68db37499f2de8acef704c73d9031be6fbcbaee4
2025-05-14 17:53:17 +0000 to 2025-05-22 14:27:15 +0000
- chore(gh): Add new-lint issue template (rust-lang/cargo#15575)
- fix(toml): Remove workaround for rustc frontmatter support (rust-lang/cargo#15570)
- fix(vendor)!: vendor files with .rej/.orig suffix (rust-lang/cargo#15569)
- fix(vendor)!: direct extraction for registry sources (rust-lang/cargo#15514)
- chore(deps): update msrv (1 version) to v1.87 (rust-lang/cargo#15530)
- Fix comment for cargo/core/compiler/fingerprint/mod.rs (rust-lang/cargo#15565)
- fix: remove unnecessary workaround in standard_lib test (rust-lang/cargo#15522)
- Allow configuring arbitrary codegen backends (rust-lang/cargo#15562)
- Update dependencies (rust-lang/cargo#15557)

r? ghost
@rustbot rustbot added this to the 1.89.0 milestone May 24, 2025
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request May 25, 2025
Update cargo

9 commits in 47c911e9e6f6461f90ce19142031fe16876a3b95..68db37499f2de8acef704c73d9031be6fbcbaee4
2025-05-14 17:53:17 +0000 to 2025-05-22 14:27:15 +0000
- chore(gh): Add new-lint issue template (rust-lang/cargo#15575)
- fix(toml): Remove workaround for rustc frontmatter support (rust-lang/cargo#15570)
- fix(vendor)!: vendor files with .rej/.orig suffix (rust-lang/cargo#15569)
- fix(vendor)!: direct extraction for registry sources (rust-lang/cargo#15514)
- chore(deps): update msrv (1 version) to v1.87 (rust-lang/cargo#15530)
- Fix comment for cargo/core/compiler/fingerprint/mod.rs (rust-lang/cargo#15565)
- fix: remove unnecessary workaround in standard_lib test (rust-lang/cargo#15522)
- Allow configuring arbitrary codegen backends (rust-lang/cargo#15562)
- Update dependencies (rust-lang/cargo#15557)

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

Labels

A-manifest Area: Cargo.toml issues 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.

4 participants