@@ -108,7 +108,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
108
108
use rustc_data_structures:: svh:: Svh ;
109
109
use rustc_data_structures:: { base_n, flock} ;
110
110
use rustc_errors:: ErrorGuaranteed ;
111
- use rustc_fs_util:: { link_or_copy, LinkOrCopy } ;
111
+ use rustc_fs_util:: { link_or_copy, try_canonicalize , LinkOrCopy } ;
112
112
use rustc_session:: { Session , StableCrateId } ;
113
113
use rustc_span:: Symbol ;
114
114
@@ -223,7 +223,7 @@ pub fn prepare_session_directory(
223
223
// because, on windows, long paths can cause problems;
224
224
// canonicalization inserts this weird prefix that makes windows
225
225
// tolerate long paths.
226
- let crate_dir = match crate_dir . canonicalize ( ) {
226
+ let crate_dir = match try_canonicalize ( & crate_dir ) {
227
227
Ok ( v) => v,
228
228
Err ( err) => {
229
229
return Err ( sess. emit_err ( errors:: CanonicalizePath { path : crate_dir, err } ) ) ;
@@ -867,7 +867,7 @@ fn all_except_most_recent(
867
867
/// before passing it to std::fs::remove_dir_all(). This will convert the path
868
868
/// into the '\\?\' format, which supports much longer paths.
869
869
fn safe_remove_dir_all ( p : & Path ) -> io:: Result < ( ) > {
870
- let canonicalized = match std_fs :: canonicalize ( p) {
870
+ let canonicalized = match try_canonicalize ( p) {
871
871
Ok ( canonicalized) => canonicalized,
872
872
Err ( err) if err. kind ( ) == io:: ErrorKind :: NotFound => return Ok ( ( ) ) ,
873
873
Err ( err) => return Err ( err) ,
@@ -877,7 +877,7 @@ fn safe_remove_dir_all(p: &Path) -> io::Result<()> {
877
877
}
878
878
879
879
fn safe_remove_file ( p : & Path ) -> io:: Result < ( ) > {
880
- let canonicalized = match std_fs :: canonicalize ( p) {
880
+ let canonicalized = match try_canonicalize ( p) {
881
881
Ok ( canonicalized) => canonicalized,
882
882
Err ( err) if err. kind ( ) == io:: ErrorKind :: NotFound => return Ok ( ( ) ) ,
883
883
Err ( err) => return Err ( err) ,
0 commit comments