@@ -49,6 +49,7 @@ impl Sysroot {
49
49
}
50
50
51
51
pub fn discover ( cargo_toml : & AbsPath ) -> Result < Sysroot > {
52
+ log:: debug!( "Discovering sysroot for {}" , cargo_toml. display( ) ) ;
52
53
let current_dir = cargo_toml. parent ( ) . unwrap ( ) ;
53
54
let sysroot_src_dir = discover_sysroot_src_dir ( current_dir) ?;
54
55
let res = Sysroot :: load ( & sysroot_src_dir) ?;
@@ -115,12 +116,14 @@ fn discover_sysroot_src_dir(current_dir: &AbsPath) -> Result<AbsPathBuf> {
115
116
if let Ok ( path) = env:: var ( "RUST_SRC_PATH" ) {
116
117
let path = AbsPathBuf :: try_from ( path. as_str ( ) )
117
118
. map_err ( |path| format_err ! ( "RUST_SRC_PATH must be absolute: {}" , path. display( ) ) ) ?;
119
+ log:: debug!( "Discovered sysroot by RUST_SRC_PATH: {}" , path. display( ) ) ;
118
120
return Ok ( path) ;
119
121
}
120
122
121
123
let sysroot_path = {
122
124
let mut rustc = Command :: new ( toolchain:: rustc ( ) ) ;
123
125
rustc. current_dir ( current_dir) . args ( & [ "--print" , "sysroot" ] ) ;
126
+ log:: debug!( "Discovering sysroot by {:?}" , rustc) ;
124
127
let stdout = utf8_stdout ( rustc) ?;
125
128
AbsPathBuf :: assert ( PathBuf :: from ( stdout) )
126
129
} ;
@@ -150,6 +153,7 @@ fn get_rust_src(sysroot_path: &AbsPath) -> Option<AbsPathBuf> {
150
153
// FIXME: remove `src` when 1.47 comes out
151
154
// https://github.com/rust-lang/rust/pull/73265
152
155
let rust_src = sysroot_path. join ( "lib/rustlib/src/rust" ) ;
156
+ log:: debug!( "Checking sysroot (looking for `library` and `src` dirs): {}" , rust_src. display( ) ) ;
153
157
[ "library" , "src" ] . iter ( ) . map ( |it| rust_src. join ( it) ) . find ( |it| it. exists ( ) )
154
158
}
155
159
0 commit comments