@@ -10,6 +10,7 @@ use rustc_data_structures::fx::FxHashSet;
1010use rustc_data_structures:: svh:: Svh ;
1111use rustc_data_structures:: sync:: { FreezeReadGuard , FreezeWriteGuard } ;
1212use rustc_expand:: base:: SyntaxExtension ;
13+ use rustc_fs_util:: try_canonicalize;
1314use rustc_hir:: def_id:: { CrateNum , LocalDefId , StableCrateId , StableCrateIdMap , LOCAL_CRATE } ;
1415use rustc_hir:: definitions:: Definitions ;
1516use rustc_index:: IndexVec ;
@@ -31,7 +32,7 @@ use std::error::Error;
3132use std:: ops:: Fn ;
3233use std:: path:: Path ;
3334use std:: time:: Duration ;
34- use std:: { cmp, env , iter} ;
35+ use std:: { cmp, iter} ;
3536
3637pub struct CStore {
3738 metadata_loader : Box < MetadataLoaderDyn > ,
@@ -676,8 +677,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
676677 path : & Path ,
677678 stable_crate_id : StableCrateId ,
678679 ) -> Result < & ' static [ ProcMacro ] , CrateError > {
679- // Make sure the path contains a / or the linker will search for it.
680- let path = env:: current_dir ( ) . unwrap ( ) . join ( path) ;
680+ let path = try_canonicalize ( path) . unwrap ( ) ;
681681 let lib = load_dylib ( & path, 5 ) . map_err ( |err| CrateError :: DlOpen ( err) ) ?;
682682
683683 let sym_name = self . sess . generate_proc_macro_decls_symbol ( stable_crate_id) ;
0 commit comments