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

Some unstable features can't be used without CLI options #9371

Closed
Frago9876543210 opened this issue Apr 17, 2021 · 2 comments
Closed

Some unstable features can't be used without CLI options #9371

Frago9876543210 opened this issue Apr 17, 2021 · 2 comments
Labels
C-bug Category: bug

Comments

@Frago9876543210
Copy link

Frago9876543210 commented Apr 17, 2021

Problem
Since rust-lang/rust#83820 #[link_args] attribute was removed. According to specification of that PR new crates should use build scripts with code like that:

println!("cargo:rustc-link-arg-bins={}", arg);

However, the problem is that extra-link-arg is mentioned in the documentation of cargo unstable features, but can't used in cargo-features. So, you can only pass it as CLI option right now.

Steps (it is assumed that you are using x86_64-pc-windows-msvc toolchain)

  1. git clone --branch=fix-link-args https://github.com/Frago9876543210/min-sized-rust-windows.git
  2. cd min-sized-rust-windows
  3. cargo build --release

Lot of warning: cargo:rustc-link-arg-bins requires -Zextra-link-arg flag as result.

The only way to bypass that problem is custom aliases or manually adding -Zextra-link-arg everywhere.

Possible Solution(s)
Make possible to fallback cargo-features to -Z <feature-name> instead of hardcoded values here?

// Allow to specify whether binaries should be stripped.
[unstable] strip: bool,

Notes
Output of cargo version:

cargo 1.53.0-nightly (65d57e6f3 2021-04-04)

Output of rustc -V --verbose:

rustc 1.53.0-nightly (b0c818c5e 2021-04-16)
binary: rustc
commit-hash: b0c818c5e0fa37251d9fda2f656bf1041a2e1e1d
commit-date: 2021-04-16
host: x86_64-pc-windows-msvc
release: 1.53.0-nightly
LLVM version: 12.0.0
@Frago9876543210 Frago9876543210 added the C-bug Category: bug label Apr 17, 2021
@ehuss
Copy link
Contributor

ehuss commented Apr 18, 2021

Hi! Using cargo-features still requires -Zunstable-options, so command-line flags will still be required. It might be possible to support cli flags in the config, but would that address your use case even if you still have to pass -Zunstable-options?

@PiDelport
Copy link

This can be configured in .cargo/config.toml:

[unstable]
extra-link-arg = true

See: #8127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants