@@ -340,7 +340,7 @@ impl<'cfg> PathSource<'cfg> {
340
340
ret. extend ( files. into_iter ( ) ) ;
341
341
}
342
342
Err ( ..) => {
343
- PathSource :: walk ( & file_path, & mut ret, false , filter) ?;
343
+ self . walk ( & file_path, & mut ret, false , filter) ?;
344
344
}
345
345
}
346
346
} else if filter ( & file_path, is_dir) {
@@ -378,11 +378,12 @@ impl<'cfg> PathSource<'cfg> {
378
378
filter : & mut dyn FnMut ( & Path , bool ) -> bool ,
379
379
) -> CargoResult < Vec < PathBuf > > {
380
380
let mut ret = Vec :: new ( ) ;
381
- PathSource :: walk ( pkg. root ( ) , & mut ret, true , filter) ?;
381
+ self . walk ( pkg. root ( ) , & mut ret, true , filter) ?;
382
382
Ok ( ret)
383
383
}
384
384
385
385
fn walk (
386
+ & self ,
386
387
path : & Path ,
387
388
ret : & mut Vec < PathBuf > ,
388
389
is_root : bool ,
@@ -420,9 +421,22 @@ impl<'cfg> PathSource<'cfg> {
420
421
true
421
422
} ) ;
422
423
for entry in walkdir {
423
- let entry = entry?;
424
- if !entry. file_type ( ) . is_dir ( ) {
425
- ret. push ( entry. path ( ) . to_path_buf ( ) ) ;
424
+ match entry {
425
+ Ok ( entry) => {
426
+ if !entry. file_type ( ) . is_dir ( ) {
427
+ ret. push ( entry. into_path ( ) ) ;
428
+ }
429
+ }
430
+ Err ( err) if err. loop_ancestor ( ) . is_some ( ) => {
431
+ self . config . shell ( ) . warn ( err) ?;
432
+ }
433
+ Err ( err) => match err. path ( ) {
434
+ // If the error occurs with a path, simply recover from it.
435
+ // Don't worry about error skipping here, the callers would
436
+ // still hit the IO error if they do access it thereafter.
437
+ Some ( path) => ret. push ( path. to_path_buf ( ) ) ,
438
+ None => return Err ( err. into ( ) ) ,
439
+ } ,
426
440
}
427
441
}
428
442
0 commit comments