Skip to content
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

Global cargo-features #11552

Closed
flippette opened this issue Jan 8, 2023 · 5 comments · Fixed by #11562
Closed

Global cargo-features #11552

flippette opened this issue Jan 8, 2023 · 5 comments · Fixed by #11562
Labels
A-config-profile Area: `[profile]` in cargo config files A-configuration Area: cargo config files and env vars A-unstable Area: nightly unstable support C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@flippette
Copy link

flippette commented Jan 8, 2023

Problem

Currently it's not possible as far as I'm aware of to use cargo-features in $CARGO_HOME/config.toml, even when using a nightly build. Am I missing something?

Proposed Solution

No response

Notes

No response

@flippette flippette added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jan 8, 2023
@weihanglo
Copy link
Member

AFAIK, that is intentional. cargo-features is for enabling Cargo.toml extensions for a certain Cargo.toml, whereas a config.toml is more like an environment setting. This is documented in "Unstable Features" chapter in The Cargo Book.

I'd like to know which feature you want to use but is blocked. Having a more specific example may help. Thank you.

@flippette
Copy link
Author

I wanted to do something similar to this:

cargo-features = ["profile-rustflags", "codegen-backend"]

[profile.dev]
codegen-backend = "cranelift"

[profile.rel_local]
inherits = "release"
rustflags = ["-Ctarget-cpu=native"]

@flippette
Copy link
Author

I managed to work around profile.rel_local with this:

(.cargo/config.toml)

[alias]
"i" = "install --config configs/install.toml

(.cargo/configs/install.toml)

[env]
RUSTFLAGS = ["-Ctarget-cpu=native"]

Yet I'm still unsure how to work around profile.dev since unlike RUSTFLAGS, there doesn't seem to be any environment variables associated with codegen-backend.

@weihanglo
Copy link
Member

My poor memomry! I found this is a duplicate of #9926. I'll close it in favor of that. We could have more discussions there. Thank you!

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2023
@weihanglo
Copy link
Member

Reopen this as the feature in #9926 has been stabilized. It is more clear to jot down notes on this issue.

Cargo team talked about this in today's meeting. The team decided not to have a general purpose way enabling features via configuration (.cargo/config.toml). Instead, we will enable -Z flag for an unstable Cargo syntax case by case.

For #11552 in [profile] Cargo should allow

to be set via config.toml.

@weihanglo weihanglo reopened this Jan 10, 2023
@weihanglo weihanglo added A-configuration Area: cargo config files and env vars A-unstable Area: nightly unstable support labels Jan 14, 2023
@weihanglo weihanglo added the A-config-profile Area: `[profile]` in cargo config files label Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-config-profile Area: `[profile]` in cargo config files A-configuration Area: cargo config files and env vars A-unstable Area: nightly unstable support C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants