cargo build will fail when passing RUSTFLAGS like --print sysroot, --print native-static-libs, etc.
I guess cargo will read stdout for other purposes?
For example:
$ cargo new hello_world --bin
Created binary (application) `hello_world` project
$ cd hello_world
$ RUSTFLAGS="--print sysroot" cargo build
error: unexpected character in cfg `/`, expected parens, a comma, an identifier, or a string
Versions:
$ cargo -V
cargo 0.23.0-nightly (8118b02ac 2017-09-14)