@@ -536,7 +536,7 @@ fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[P
536
536
537
537
let write_deps_to_file = |file : & mut dyn Write | -> io:: Result < ( ) > {
538
538
for path in out_filenames {
539
- writeln ! (
539
+ write ! (
540
540
file,
541
541
"{}: {}\n " ,
542
542
path. display( ) ,
@@ -546,6 +546,25 @@ fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[P
546
546
. intersperse( " " )
547
547
. collect:: <String >( )
548
548
) ?;
549
+
550
+ // If caller requested this information, add special comments about source file checksums.
551
+ // These are not necessarily the same checksums as was used in the debug files.
552
+ if sess. opts . unstable_opts . checksum_hash_algorithm ( ) . is_some ( ) {
553
+ assert ! (
554
+ files. iter( ) . all( |( _path, _file_len, hash_algo) | hash_algo. is_some( ) ) ,
555
+ "all files must have a checksum hash computed to output checksum hashes"
556
+ ) ;
557
+ write ! ( file, " # " ) ?;
558
+ files
559
+ . iter ( )
560
+ . filter_map ( |( _path, file_len, hash_algo) | {
561
+ hash_algo. map ( |hash_algo| ( path, file_len, hash_algo) )
562
+ } )
563
+ . try_for_each ( |( _path, file_len, checksum_hash) | {
564
+ write ! ( file, "checksum:{checksum_hash} file_len:{file_len}, " )
565
+ } ) ?;
566
+ }
567
+ writeln ! ( file) ?;
549
568
}
550
569
551
570
// Emit a fake target for each input file to the compilation. This
@@ -575,18 +594,6 @@ fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[P
575
594
}
576
595
}
577
596
578
- // If caller requested this information, add special comments about source file checksums.
579
- // These are not necessarily the same checksums as was used in the debug files.
580
- if sess. opts . unstable_opts . checksum_hash_algorithm ( ) . is_some ( ) {
581
- for ( path, file_len, checksum_hash) in
582
- files. iter ( ) . filter_map ( |( path, file_len, hash_algo) | {
583
- hash_algo. map ( |hash_algo| ( path, file_len, hash_algo) )
584
- } )
585
- {
586
- writeln ! ( file, "# checksum:{checksum_hash} file_len:{file_len} {path}" ) ?;
587
- }
588
- }
589
-
590
597
Ok ( ( ) )
591
598
} ;
592
599
0 commit comments