Skip to content

build.rustflags is passed twice (and rustc errors) #3070

@bluss

Description

@bluss

If I use this in ~/.cargo/config, the flag is passed twice:

[build]
rustflags = ["-Cllvm-args=-x86-asm-syntax=intel"]

This does not apply to configuration directories stored directly under my project's root (using projectname/.cargo/config, the option is passed only once). There is only a single cargo config file involved in each scenario.

For this particular flag, it stops the build with an error:

$ cargo build
error: failed to run `rustc` to learn about target-specific information

Caused by:
  Process didn't exit successfully: `rustc - --crate-name _ --print=file-names -Cllvm-args=-x86-asm-syntax=intel -Cllvm-args=-x86-asm-syntax=intel --crate-type bin --crate-type rl
ib --target x86_64-unknown-linux-gnu` (exit code: 1)
--- stderr
rustc: for the -x86-asm-syntax option: may only occur zero or one times!

Also related: #3052, but this issue is for the specific bug of doubling the flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyExperience: Easy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions