-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Allow configuring arbitrary codegen backends #15562
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
Allow configuring arbitrary codegen backends #15562
Conversation
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.
name, | ||
codegen_backend, | ||
); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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
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.