@@ -30,6 +30,7 @@ use crate::{
3030 utf8_stdout, CargoConfig , CargoWorkspace , InvocationStrategy , ManifestPath , Package ,
3131 ProjectJson , ProjectManifest , Sysroot , TargetData , TargetKind , WorkspaceBuildScripts ,
3232} ;
33+ use tracing:: { debug, error, info, Level } ;
3334
3435pub type FileLoader < ' a > = & ' a mut dyn for < ' b > FnMut ( & ' b AbsPath ) -> Option < FileId > ;
3536
@@ -249,7 +250,7 @@ impl ProjectWorkspace {
249250 } ;
250251
251252 let rustc = rustc_dir. and_then ( |rustc_dir| {
252- tracing :: info!( workspace = %cargo_toml, rustc_dir = %rustc_dir, "Using rustc source" ) ;
253+ info ! ( workspace = %cargo_toml, rustc_dir = %rustc_dir, "Using rustc source" ) ;
253254 match CargoWorkspace :: fetch_metadata (
254255 & rustc_dir,
255256 cargo_toml. parent ( ) ,
@@ -705,7 +706,7 @@ impl ProjectWorkspace {
705706 load : FileLoader < ' _ > ,
706707 extra_env : & FxHashMap < String , String > ,
707708 ) -> ( CrateGraph , ProcMacroPaths ) {
708- let _p = tracing:: span!( tracing:: Level :: INFO , "ProjectWorkspace:: to_crate_graph" ) . entered ( ) ;
709+ let _p = tracing:: span!( tracing:: Level :: INFO , "to_crate_graph" ) . entered ( ) ;
709710
710711 let Self { kind, sysroot, cfg_overrides, rustc_cfg, .. } = self ;
711712 let ( ( mut crate_graph, proc_macros) , sysroot) = match kind {
@@ -762,9 +763,9 @@ impl ProjectWorkspace {
762763 } ;
763764
764765 if matches ! ( sysroot. mode( ) , SysrootMode :: Stitched ( _) ) && crate_graph. patch_cfg_if ( ) {
765- tracing :: debug!( "Patched std to depend on cfg-if" )
766+ debug ! ( "Patched std to depend on cfg-if" )
766767 } else {
767- tracing :: debug!( "Did not patch std to depend on cfg-if" )
768+ debug ! ( "Did not patch std to depend on cfg-if" )
768769 }
769770 ( crate_graph, proc_macros)
770771 }
@@ -909,6 +910,11 @@ fn project_json_to_crate_graph(
909910 CrateOrigin :: Local { repo : None , name : None }
910911 } ,
911912 ) ;
913+ debug ! (
914+ ?crate_graph_crate_id,
915+ crate = display_name. as_ref( ) . map( |name| name. canonical_name( ) ) ,
916+ "added root to crate graph"
917+ ) ;
912918 if * is_proc_macro {
913919 if let Some ( path) = proc_macro_dylib_path. clone ( ) {
914920 let node = Ok ( (
@@ -923,6 +929,7 @@ fn project_json_to_crate_graph(
923929 )
924930 . collect ( ) ;
925931
932+ debug ! ( map = ?idx_to_crate_id) ;
926933 for ( from_idx, krate) in project. crates ( ) {
927934 if let Some ( & from) = idx_to_crate_id. get ( & from_idx) {
928935 public_deps. add_to_crate_graph ( crate_graph, from) ;
@@ -949,7 +956,7 @@ fn cargo_to_crate_graph(
949956 override_cfg : & CfgOverrides ,
950957 build_scripts : & WorkspaceBuildScripts ,
951958) -> ( CrateGraph , ProcMacroPaths ) {
952- let _p = tracing:: span!( tracing :: Level :: INFO , "cargo_to_crate_graph" ) . entered ( ) ;
959+ let _p = tracing:: span!( Level :: INFO , "cargo_to_crate_graph" ) . entered ( ) ;
953960 let mut res = ( CrateGraph :: default ( ) , ProcMacroPaths :: default ( ) ) ;
954961 let crate_graph = & mut res. 0 ;
955962 let proc_macros = & mut res. 1 ;
@@ -1134,7 +1141,7 @@ fn detached_file_to_crate_graph(
11341141 sysroot : & Sysroot ,
11351142 override_cfg : & CfgOverrides ,
11361143) -> ( CrateGraph , ProcMacroPaths ) {
1137- let _p = tracing:: span!( tracing :: Level :: INFO , "detached_file_to_crate_graph" ) . entered ( ) ;
1144+ let _p = tracing:: span!( Level :: INFO , "detached_file_to_crate_graph" ) . entered ( ) ;
11381145 let mut crate_graph = CrateGraph :: default ( ) ;
11391146 let ( public_deps, _libproc_macro) =
11401147 sysroot_to_crate_graph ( & mut crate_graph, sysroot, rustc_cfg. clone ( ) , load) ;
@@ -1148,7 +1155,7 @@ fn detached_file_to_crate_graph(
11481155 let file_id = match load ( detached_file) {
11491156 Some ( file_id) => file_id,
11501157 None => {
1151- tracing :: error!( "Failed to load detached file {:?}" , detached_file) ;
1158+ error ! ( "Failed to load detached file {:?}" , detached_file) ;
11521159 return ( crate_graph, FxHashMap :: default ( ) ) ;
11531160 }
11541161 } ;
@@ -1345,7 +1352,7 @@ fn add_target_crate_root(
13451352 crate_id
13461353}
13471354
1348- #[ derive( Default ) ]
1355+ #[ derive( Default , Debug ) ]
13491356struct SysrootPublicDeps {
13501357 deps : Vec < ( CrateName , CrateId , bool ) > ,
13511358}
0 commit comments