@@ -2276,3 +2276,71 @@ fn build_script_features_for_shared_dependency() {
2276
2276
. masquerade_as_nightly_cargo ( & [ "bindeps" ] )
2277
2277
. run ( ) ;
2278
2278
}
2279
+
2280
+ #[ cargo_test]
2281
+ fn calc_bin_artifact_fingerprint ( ) {
2282
+ // This records the WRONG behaviour. See rust-lang/cargo#10527
2283
+ let p = project ( )
2284
+ . file (
2285
+ "Cargo.toml" ,
2286
+ r#"
2287
+ [package]
2288
+ name = "foo"
2289
+ version = "0.1.0"
2290
+ resolver = "2"
2291
+
2292
+ [dependencies]
2293
+ bar = { path = "bar/", artifact = "bin" }
2294
+ "# ,
2295
+ )
2296
+ . file (
2297
+ "src/main.rs" ,
2298
+ r#"
2299
+ fn main() {
2300
+ let _b = include_bytes!(env!("CARGO_BIN_FILE_BAR"));
2301
+ }
2302
+ "# ,
2303
+ )
2304
+ . file ( "bar/Cargo.toml" , & basic_bin_manifest ( "bar" ) )
2305
+ . file ( "bar/src/main.rs" , r#"fn main() { println!("foo") }"# )
2306
+ . build ( ) ;
2307
+ p. cargo ( "check -Z bindeps" )
2308
+ . masquerade_as_nightly_cargo ( & [ "bindeps" ] )
2309
+ . with_stderr (
2310
+ "\
2311
+ [COMPILING] bar v0.5.0 ([CWD]/bar)
2312
+ [CHECKING] foo v0.1.0 ([CWD])
2313
+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2314
+ " ,
2315
+ )
2316
+ . run ( ) ;
2317
+
2318
+ p. change_file ( "bar/src/main.rs" , r#"fn main() { println!("bar") }"# ) ;
2319
+ // Change in bin artifact but not propagated to parent fingerprint.
2320
+ // This is WRONG!
2321
+ p. cargo ( "check -v -Z bindeps" )
2322
+ . masquerade_as_nightly_cargo ( & [ "bindeps" ] )
2323
+ . with_stderr (
2324
+ "\
2325
+ [COMPILING] bar v0.5.0 ([CWD]/bar)
2326
+ [RUNNING] `rustc --crate-name bar [..]`
2327
+ [FRESH] foo v0.1.0 ([CWD])
2328
+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2329
+ " ,
2330
+ )
2331
+ . run ( ) ;
2332
+
2333
+ // Only run the second time can parent fingerpint perceive the change.
2334
+ // This is WRONG!
2335
+ p. cargo ( "check -v -Z bindeps" )
2336
+ . masquerade_as_nightly_cargo ( & [ "bindeps" ] )
2337
+ . with_stderr (
2338
+ "\
2339
+ [FRESH] bar v0.5.0 ([CWD]/bar)
2340
+ [CHECKING] foo v0.1.0 ([CWD])
2341
+ [RUNNING] `rustc --crate-name foo [..]`
2342
+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2343
+ " ,
2344
+ )
2345
+ . run ( ) ;
2346
+ }
0 commit comments