@@ -234,10 +234,21 @@ pub fn prepare_session_directory(tcx: TyCtxt) -> Result<bool, ()> {
234
234
let print_file_copy_stats = tcx. sess . opts . debugging_opts . incremental_info ;
235
235
236
236
// Try copying over all files from the source directory
237
- if copy_files ( & session_dir, & source_directory, print_file_copy_stats) . is_ok ( ) {
237
+ if let Ok ( allows_links) = copy_files ( & session_dir, & source_directory,
238
+ print_file_copy_stats) {
238
239
debug ! ( "successfully copied data from: {}" ,
239
240
source_directory. display( ) ) ;
240
241
242
+ if !allows_links {
243
+ tcx. sess . warn ( & format ! ( "Hard linking files in the incremental \
244
+ compilation cache failed. Copying files \
245
+ instead. Consider moving the cache \
246
+ directory to a file system which supports \
247
+ hard linking in session dir `{}`",
248
+ session_dir. display( ) )
249
+ ) ;
250
+ }
251
+
241
252
tcx. sess . init_incr_comp_session ( session_dir, directory_lock) ;
242
253
return Ok ( true )
243
254
} else {
@@ -357,7 +368,7 @@ pub fn delete_all_session_dir_contents(sess: &Session) -> io::Result<()> {
357
368
fn copy_files ( target_dir : & Path ,
358
369
source_dir : & Path ,
359
370
print_stats_on_success : bool )
360
- -> Result < ( ) , ( ) > {
371
+ -> Result < bool , ( ) > {
361
372
// We acquire a shared lock on the lock file of the directory, so that
362
373
// nobody deletes it out from under us while we are reading from it.
363
374
let lock_file_path = lock_file_path ( source_dir) ;
@@ -409,7 +420,7 @@ fn copy_files(target_dir: &Path,
409
420
println ! ( "incr. comp. session directory: {} files copied" , files_copied) ;
410
421
}
411
422
412
- Ok ( ( ) )
423
+ Ok ( files_linked > 0 || files_copied == 0 )
413
424
}
414
425
415
426
/// Generate unique directory path of the form:
0 commit comments