Skip to content

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

Closed
@Frago9876543210

Description

@Frago9876543210

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions