@@ -1676,7 +1676,7 @@ impl Build {
1676
1676
if src == dst {
1677
1677
return ;
1678
1678
}
1679
- let _ = fs:: remove_file ( dst) ;
1679
+ let _ = rety ( 60 , || fs:: remove_file ( dst) ) ;
1680
1680
let metadata = t ! ( src. symlink_metadata( ) , format!( "src = {}" , src. display( ) ) ) ;
1681
1681
let mut src = src. to_path_buf ( ) ;
1682
1682
if metadata. file_type ( ) . is_symlink ( ) {
@@ -1688,25 +1688,18 @@ impl Build {
1688
1688
return ;
1689
1689
}
1690
1690
}
1691
- // workaround for https://github.com/rust-lang/rust/issues/127126
1692
- // retry linking or copying up to 10 times or until success.
1693
- let result: io:: Result < ( ) > = retry ( 10 , || {
1694
- if let Ok ( ( ) ) = fs:: hard_link ( & src, dst) {
1695
- // Attempt to "easy copy" by creating a hard link
1696
- // (symlinks don't work on windows), but if that fails
1697
- // just fall back to a slow `copy` operation.
1698
- Ok ( ( ) )
1699
- } else {
1700
- fs:: copy ( & src, dst) ?;
1701
- t ! ( fs:: set_permissions( dst, metadata. permissions( ) ) ) ;
1702
- let atime = FileTime :: from_last_access_time ( & metadata) ;
1703
- let mtime = FileTime :: from_last_modification_time ( & metadata) ;
1704
- t ! ( filetime:: set_file_times( dst, atime, mtime) ) ;
1705
- Ok ( ( ) )
1691
+ if let Ok ( ( ) ) = fs:: hard_link ( & src, dst) {
1692
+ // Attempt to "easy copy" by creating a hard link
1693
+ // (symlinks don't work on windows), but if that fails
1694
+ // just fall back to a slow `copy` operation.
1695
+ } else {
1696
+ if let Err ( e) = fs:: copy ( & src, dst) {
1697
+ panic ! ( "failed to copy `{}` to `{}`: {}" , src. display( ) , dst. display( ) , e)
1706
1698
}
1707
- } ) ;
1708
- if let Err ( e) = result {
1709
- panic ! ( "failed to copy `{}` to `{}`: {}" , src. display( ) , dst. display( ) , e)
1699
+ t ! ( fs:: set_permissions( dst, metadata. permissions( ) ) ) ;
1700
+ let atime = FileTime :: from_last_access_time ( & metadata) ;
1701
+ let mtime = FileTime :: from_last_modification_time ( & metadata) ;
1702
+ t ! ( filetime:: set_file_times( dst, atime, mtime) ) ;
1710
1703
}
1711
1704
}
1712
1705
0 commit comments