Skip to content

-C target-feature=+foo overrides previous values #56527

Closed
@jbeich

Description

@jbeich

I'm trying to pass multiple -C target-feature conditionally downstream. However, despite +/- for adding/removing a feature it appears only the last value takes effect.

$ cat >a.rs
fn main() {
    if cfg!(target_feature="avx2") {
        println!("AVX2 available");
    }
    if cfg!(target_feature="fma") {
        println!("FMA available");
    }
}

$ rustc a.rs -C target-feature=+avx2 -C target-feature=+fma
$ ./a
FMA available
$ rustc a.rs -C target-feature=+avx2,+fma
$ ./a
AVX2 available
FMA available

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-driverArea: rustc_driver that ties everything together into the `rustc` compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions