File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
tests/cargo_config.in/.cargo Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -145,8 +145,9 @@ impl BuildOptions<'_> {
145
145
// Use --config to set rustflags
146
146
// Our rust integration has an msrv of 1.74, --config is available since 1.63
147
147
// https://doc.rust-lang.org/nightly/cargo/CHANGELOG.html#cargo-163-2022-08-11
148
+ // Note: We have to use `target.cfg(all())` since `build` has a lower precedence.
148
149
let config_value = format ! (
149
- "build .rustflags=[{}]" ,
150
+ "target.'cfg(all())' .rustflags=[{}]" ,
150
151
flags. into_iter( ) . map( |f| format!( "\" {f}\" " ) ) . join( "," )
151
152
) ;
152
153
cargo. arg ( "--config" ) . arg ( config_value) ;
Original file line number Diff line number Diff line change
1
+ # Note: This does nothing since `target.<cfg>.rustflags` takes precedence over `build.rustflags`
2
+ # See: https://doc.rust-lang.org/nightly/cargo/reference/config.html#buildrustflags
1
3
[build ]
4
+ rustflags = [" --cfg" , " this_does_nothing" ]
5
+
6
+ [target .'cfg(all())' ]
2
7
rustflags = [" --cfg" , " custom_feature_flag" ]
You can’t perform that action at this time.
0 commit comments