Closed
Description
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
Activity
textproc/ripgrep: unbreak AVX=on on i386 after r454995
MFH: r486650
textproc/ripgrep: unbreak AVX=on on i386 after r454995
textproc/ripgrep: unbreak AVX=on on i386 after r454995
textproc/ripgrep: unbreak AVX=on on i386 after r454995
cuviper commentedon Dec 7, 2018
FWIW, you can check for
cfg
values without any test program like:petrochenkov commentedon May 9, 2020
I agree that it's a bug and will try to fix it.
petrochenkov commentedon May 11, 2020
Fixed in #72094.
Rollup merge of rust-lang#72094 - petrochenkov:overfeature, r=nikic
Rollup merge of rust-lang#72094 - petrochenkov:overfeature, r=nikic
2 remaining items