Originally reported in RustCrypto/stream-ciphers#11
Create a project with following files. Cargo.toml:
[target.'cfg(target_feature="aes")'.dependencies]
either = "*"
.cargo/config:
[target.'cfg(any(windows, unix))']
rustflags = ["-Ctarget-feature=+aes"]
src/main.rs:
#[cfg(target_feature="aes")]
fn main() { println!("aes enabled"); }
#[cfg(not(target_feature="aes"))]
fn main() { println!("aes disabled"); }
Running cargo run outputs "aes disabled" as expected, but either crate does not get downloaded, i.e. cfg statement in Cargo.toml does not work as expected. And as a consequence adding #[cfg(target_feature="aes")] extern crate either; to main.rs results in a compilation error. Meanwhile RUSTFLAGS="-C target-feature=+aes" cargo run works as expected without any issues.
Originally reported in RustCrypto/stream-ciphers#11
Create a project with following files. Cargo.toml:
.cargo/config:
src/main.rs:
Running
cargo runoutputs "aes disabled" as expected, buteithercrate does not get downloaded, i.e.cfgstatement inCargo.tomldoes not work as expected. And as a consequence adding#[cfg(target_feature="aes")] extern crate either;tomain.rsresults in a compilation error. MeanwhileRUSTFLAGS="-C target-feature=+aes" cargo runworks as expected without any issues.