@@ -49,6 +49,7 @@ impl Sysroot {
4949 }
5050
5151 pub fn discover ( cargo_toml : & AbsPath ) -> Result < Sysroot > {
52+ log:: debug!( "Discovering sysroot for {}" , cargo_toml. display( ) ) ;
5253 let current_dir = cargo_toml. parent ( ) . unwrap ( ) ;
5354 let sysroot_src_dir = discover_sysroot_src_dir ( current_dir) ?;
5455 let res = Sysroot :: load ( & sysroot_src_dir) ?;
@@ -115,12 +116,14 @@ fn discover_sysroot_src_dir(current_dir: &AbsPath) -> Result<AbsPathBuf> {
115116 if let Ok ( path) = env:: var ( "RUST_SRC_PATH" ) {
116117 let path = AbsPathBuf :: try_from ( path. as_str ( ) )
117118 . map_err ( |path| format_err ! ( "RUST_SRC_PATH must be absolute: {}" , path. display( ) ) ) ?;
119+ log:: debug!( "Discovered sysroot by RUST_SRC_PATH: {}" , path. display( ) ) ;
118120 return Ok ( path) ;
119121 }
120122
121123 let sysroot_path = {
122124 let mut rustc = Command :: new ( toolchain:: rustc ( ) ) ;
123125 rustc. current_dir ( current_dir) . args ( & [ "--print" , "sysroot" ] ) ;
126+ log:: debug!( "Discovering sysroot by {:?}" , rustc) ;
124127 let stdout = utf8_stdout ( rustc) ?;
125128 AbsPathBuf :: assert ( PathBuf :: from ( stdout) )
126129 } ;
@@ -150,6 +153,7 @@ fn get_rust_src(sysroot_path: &AbsPath) -> Option<AbsPathBuf> {
150153 // FIXME: remove `src` when 1.47 comes out
151154 // https://github.com/rust-lang/rust/pull/73265
152155 let rust_src = sysroot_path. join ( "lib/rustlib/src/rust" ) ;
156+ log:: debug!( "Checking sysroot (looking for `library` and `src` dirs): {}" , rust_src. display( ) ) ;
153157 [ "library" , "src" ] . iter ( ) . map ( |it| rust_src. join ( it) ) . find ( |it| it. exists ( ) )
154158}
155159
0 commit comments