@@ -1151,23 +1151,24 @@ fn reuse_shared_build_dep() {
1151
1151
fn changing_rustflags_is_cached ( ) {
1152
1152
let p = project ( ) . file ( "src/lib.rs" , "" ) . build ( ) ;
1153
1153
1154
- p . cargo ( "build" ) . run ( ) ;
1155
- p . cargo ( "build" )
1156
- . env ( "RUSTFLAGS" , "-C linker=cc ")
1157
- . with_stderr (
1158
- "\
1154
+ // This isn't ever cached, we always have to recompile
1155
+ for _ in 0 .. 2 {
1156
+ p . cargo ( "build ")
1157
+ . with_stderr (
1158
+ "\
1159
1159
[COMPILING] foo v0.0.1 ([..])
1160
1160
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" ,
1161
- )
1162
- . run ( ) ;
1163
- // This should not recompile!
1164
- p. cargo ( "build" )
1165
- . with_stderr ( "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )
1166
- . run ( ) ;
1167
- p. cargo ( "build" )
1168
- . env ( "RUSTFLAGS" , "-C linker=cc" )
1169
- . with_stderr ( "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )
1170
- . run ( ) ;
1161
+ )
1162
+ . run ( ) ;
1163
+ p. cargo ( "build" )
1164
+ . env ( "RUSTFLAGS" , "-C linker=cc" )
1165
+ . with_stderr (
1166
+ "\
1167
+ [COMPILING] foo v0.0.1 ([..])
1168
+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" ,
1169
+ )
1170
+ . run ( ) ;
1171
+ }
1171
1172
}
1172
1173
1173
1174
#[ cargo_test]
@@ -1257,6 +1258,9 @@ fn fingerprint_cleaner_does_not_rebuild() {
1257
1258
1258
1259
[dependencies]
1259
1260
bar = { path = "bar" }
1261
+
1262
+ [features]
1263
+ a = []
1260
1264
"# ,
1261
1265
)
1262
1266
. file ( "src/lib.rs" , "" )
@@ -1267,12 +1271,10 @@ fn fingerprint_cleaner_does_not_rebuild() {
1267
1271
p. cargo ( "build -Z mtime-on-use" )
1268
1272
. masquerade_as_nightly_cargo ( )
1269
1273
. run ( ) ;
1270
- p. cargo ( "build -Z mtime-on-use" )
1274
+ p. cargo ( "build -Z mtime-on-use --features a " )
1271
1275
. masquerade_as_nightly_cargo ( )
1272
- . env ( "RUSTFLAGS" , "-C linker=cc" )
1273
1276
. with_stderr (
1274
1277
"\
1275
- [COMPILING] bar v0.0.1 ([..])
1276
1278
[COMPILING] foo v0.0.1 ([..])
1277
1279
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" ,
1278
1280
)
@@ -1285,24 +1287,21 @@ fn fingerprint_cleaner_does_not_rebuild() {
1285
1287
sleep_ms ( 1000 ) ;
1286
1288
}
1287
1289
// This does not make new files, but it does update the mtime.
1288
- p. cargo ( "build -Z mtime-on-use" )
1290
+ p. cargo ( "build -Z mtime-on-use --features a " )
1289
1291
. masquerade_as_nightly_cargo ( )
1290
- . env ( "RUSTFLAGS" , "-C linker=cc" )
1291
1292
. with_stderr ( "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )
1292
1293
. run ( ) ;
1293
1294
fingerprint_cleaner ( p. target_debug_dir ( ) , timestamp) ;
1294
1295
// This should not recompile!
1295
- p. cargo ( "build -Z mtime-on-use" )
1296
+ p. cargo ( "build -Z mtime-on-use --features a " )
1296
1297
. masquerade_as_nightly_cargo ( )
1297
- . env ( "RUSTFLAGS" , "-C linker=cc" )
1298
1298
. with_stderr ( "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )
1299
1299
. run ( ) ;
1300
1300
// But this should be cleaned and so need a rebuild
1301
1301
p. cargo ( "build -Z mtime-on-use" )
1302
1302
. masquerade_as_nightly_cargo ( )
1303
1303
. with_stderr (
1304
1304
"\
1305
- [COMPILING] bar v0.0.1 ([..])
1306
1305
[COMPILING] foo v0.0.1 ([..])
1307
1306
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" ,
1308
1307
)
0 commit comments