@@ -206,8 +206,8 @@ impl CStore {
206206
207207 fn intern_stable_crate_id < ' tcx > (
208208 & mut self ,
209- root : & CrateRoot ,
210209 tcx : TyCtxt < ' tcx > ,
210+ root : & CrateRoot ,
211211 ) -> Result < TyCtxtFeed < ' tcx , CrateNum > , CrateError > {
212212 assert_eq ! ( self . metas. len( ) , tcx. untracked( ) . stable_crate_ids. read( ) . len( ) ) ;
213213 let num = tcx. create_crate_num ( root. stable_crate_id ( ) ) . map_err ( |existing| {
@@ -480,10 +480,10 @@ impl CStore {
480480
481481 fn existing_match (
482482 & self ,
483+ tcx : TyCtxt < ' _ > ,
483484 name : Symbol ,
484485 hash : Option < Svh > ,
485486 kind : PathKind ,
486- tcx : TyCtxt < ' _ > ,
487487 ) -> Option < CrateNum > {
488488 for ( cnum, data) in self . iter_crate_data ( ) {
489489 if data. name ( ) != name {
@@ -563,10 +563,10 @@ impl CStore {
563563 /// command parameter is set to `public-dependency`
564564 fn is_private_dep < ' tcx > (
565565 & self ,
566+ tcx : TyCtxt < ' tcx > ,
566567 name : Symbol ,
567568 private_dep : Option < bool > ,
568569 origin : CrateOrigin < ' _ > ,
569- tcx : TyCtxt < ' tcx > ,
570570 ) -> bool {
571571 if matches ! ( origin, CrateOrigin :: Injected ) {
572572 return true ;
@@ -584,24 +584,24 @@ impl CStore {
584584
585585 fn register_crate < ' tcx > (
586586 & mut self ,
587+ tcx : TyCtxt < ' tcx > ,
587588 host_lib : Option < Library > ,
588589 origin : CrateOrigin < ' _ > ,
589590 lib : Library ,
590591 dep_kind : CrateDepKind ,
591592 name : Symbol ,
592593 private_dep : Option < bool > ,
593- tcx : TyCtxt < ' tcx > ,
594594 ) -> Result < CrateNum , CrateError > {
595595 let _prof_timer =
596596 tcx. sess . prof . generic_activity_with_arg ( "metadata_register_crate" , name. as_str ( ) ) ;
597597
598598 let Library { source, metadata } = lib;
599599 let crate_root = metadata. get_root ( ) ;
600600 let host_hash = host_lib. as_ref ( ) . map ( |lib| lib. metadata . get_root ( ) . hash ( ) ) ;
601- let private_dep = self . is_private_dep ( name, private_dep, origin, tcx ) ;
601+ let private_dep = self . is_private_dep ( tcx , name, private_dep, origin) ;
602602
603603 // Claim this crate number and cache it
604- let feed = self . intern_stable_crate_id ( & crate_root , tcx ) ?;
604+ let feed = self . intern_stable_crate_id ( tcx , & crate_root ) ?;
605605 let cnum = feed. key ( ) ;
606606
607607 info ! (
@@ -622,13 +622,13 @@ impl CStore {
622622 } ;
623623
624624 let cnum_map = self . resolve_crate_deps (
625+ tcx,
625626 dep_root,
626627 & crate_root,
627628 & metadata,
628629 cnum,
629630 dep_kind,
630631 private_dep,
631- tcx,
632632 ) ?;
633633
634634 let raw_proc_macros = if crate_root. is_proc_macro_crate ( ) {
@@ -641,7 +641,7 @@ impl CStore {
641641 None => ( & source, & crate_root) ,
642642 } ;
643643 let dlsym_dylib = dlsym_source. dylib . as_ref ( ) . expect ( "no dylib for a proc-macro crate" ) ;
644- Some ( self . dlsym_proc_macros ( & dlsym_dylib. 0 , dlsym_root. stable_crate_id ( ) , tcx ) ?)
644+ Some ( self . dlsym_proc_macros ( tcx , & dlsym_dylib. 0 , dlsym_root. stable_crate_id ( ) ) ?)
645645 } else {
646646 None
647647 } ;
@@ -667,11 +667,11 @@ impl CStore {
667667
668668 fn load_proc_macro < ' b , ' tcx > (
669669 & self ,
670+ tcx : TyCtxt < ' tcx > ,
670671 locator : & mut CrateLocator < ' b > ,
671672 crate_rejections : & mut CrateRejections ,
672673 path_kind : PathKind ,
673674 host_hash : Option < Svh > ,
674- tcx : TyCtxt < ' tcx > ,
675675 ) -> Result < Option < ( LoadResult , Option < Library > ) > , CrateError >
676676 where
677677 ' tcx : ' b ,
@@ -734,14 +734,14 @@ impl CStore {
734734
735735 fn resolve_crate < ' tcx > (
736736 & mut self ,
737+ tcx : TyCtxt < ' tcx > ,
737738 name : Symbol ,
738739 span : Span ,
739740 dep_kind : CrateDepKind ,
740741 origin : CrateOrigin < ' _ > ,
741- tcx : TyCtxt < ' tcx > ,
742742 ) -> Option < CrateNum > {
743743 self . used_extern_options . insert ( name) ;
744- match self . maybe_resolve_crate ( name, dep_kind, origin, tcx ) {
744+ match self . maybe_resolve_crate ( tcx , name, dep_kind, origin) {
745745 Ok ( cnum) => {
746746 self . set_used_recursively ( cnum) ;
747747 Some ( cnum)
@@ -750,10 +750,10 @@ impl CStore {
750750 debug ! ( "failed to resolve crate {} {:?}" , name, dep_kind) ;
751751 let missing_core = self
752752 . maybe_resolve_crate (
753+ tcx,
753754 sym:: core,
754755 CrateDepKind :: Explicit ,
755756 CrateOrigin :: Extern ,
756- tcx,
757757 )
758758 . is_err ( ) ;
759759 err. report ( tcx. sess , span, missing_core) ;
@@ -764,10 +764,10 @@ impl CStore {
764764
765765 fn maybe_resolve_crate < ' b , ' tcx > (
766766 & ' b mut self ,
767+ tcx : TyCtxt < ' tcx > ,
767768 name : Symbol ,
768769 mut dep_kind : CrateDepKind ,
769770 origin : CrateOrigin < ' b > ,
770- tcx : TyCtxt < ' tcx > ,
771771 ) -> Result < CrateNum , CrateError > {
772772 info ! ( "resolving crate `{}`" , name) ;
773773 if !name. as_str ( ) . is_ascii ( ) {
@@ -782,7 +782,7 @@ impl CStore {
782782 let path_kind = if dep. is_some ( ) { PathKind :: Dependency } else { PathKind :: Crate } ;
783783 let private_dep = origin. private_dep ( ) ;
784784
785- let result = if let Some ( cnum) = self . existing_match ( name, hash, path_kind, tcx ) {
785+ let result = if let Some ( cnum) = self . existing_match ( tcx , name, hash, path_kind) {
786786 ( LoadResult :: Previous ( cnum) , None )
787787 } else {
788788 info ! ( "falling back to a load" ) ;
@@ -805,11 +805,11 @@ impl CStore {
805805 info ! ( "falling back to loading proc_macro" ) ;
806806 dep_kind = CrateDepKind :: MacrosOnly ;
807807 match self . load_proc_macro (
808+ tcx,
808809 & mut locator,
809810 & mut crate_rejections,
810811 path_kind,
811812 host_hash,
812- tcx,
813813 ) ? {
814814 Some ( res) => res,
815815 None => return Err ( locator. into_error ( crate_rejections, dep_root. cloned ( ) ) ) ,
@@ -825,7 +825,7 @@ impl CStore {
825825 // not specified by `--extern` on command line parameters, it may be
826826 // `private-dependency` when `register_crate` is called for the first time. Then it must be updated to
827827 // `public-dependency` here.
828- let private_dep = self . is_private_dep ( name, private_dep, origin, tcx ) ;
828+ let private_dep = self . is_private_dep ( tcx , name, private_dep, origin) ;
829829 let data = self . get_crate_data_mut ( cnum) ;
830830 if data. is_proc_macro_crate ( ) {
831831 dep_kind = CrateDepKind :: MacrosOnly ;
@@ -836,7 +836,7 @@ impl CStore {
836836 }
837837 ( LoadResult :: Loaded ( library) , host_library) => {
838838 info ! ( "register newly loaded library for `{}`" , name) ;
839- self . register_crate ( host_library, origin, library, dep_kind, name, private_dep, tcx )
839+ self . register_crate ( tcx , host_library, origin, library, dep_kind, name, private_dep)
840840 }
841841 _ => panic ! ( ) ,
842842 }
@@ -871,13 +871,13 @@ impl CStore {
871871 /// Go through the crate metadata and load any crates that it references.
872872 fn resolve_crate_deps (
873873 & mut self ,
874+ tcx : TyCtxt < ' _ > ,
874875 dep_root : & CratePaths ,
875876 crate_root : & CrateRoot ,
876877 metadata : & MetadataBlob ,
877878 krate : CrateNum ,
878879 dep_kind : CrateDepKind ,
879880 parent_is_private : bool ,
880- tcx : TyCtxt < ' _ > ,
881881 ) -> Result < CrateNumMap , CrateError > {
882882 debug ! (
883883 "resolving deps of external crate `{}` with dep root `{}`" ,
@@ -908,14 +908,14 @@ impl CStore {
908908 _ => dep. kind ,
909909 } ;
910910 let cnum = self . maybe_resolve_crate (
911+ tcx,
911912 dep. name ,
912913 dep_kind,
913914 CrateOrigin :: IndirectDependency {
914915 dep_root,
915916 parent_private : parent_is_private,
916917 dep : & dep,
917918 } ,
918- tcx,
919919 ) ?;
920920 crate_num_map. push ( cnum) ;
921921 }
@@ -926,9 +926,9 @@ impl CStore {
926926
927927 fn dlsym_proc_macros < ' tcx > (
928928 & self ,
929+ tcx : TyCtxt < ' tcx > ,
929930 path : & Path ,
930931 stable_crate_id : StableCrateId ,
931- tcx : TyCtxt < ' tcx > ,
932932 ) -> Result < & ' static [ ProcMacro ] , CrateError > {
933933 let sym_name = tcx. sess . generate_proc_macro_decls_symbol ( stable_crate_id) ;
934934 debug ! ( "trying to dlsym proc_macros {} for symbol `{}`" , path. display( ) , sym_name) ;
@@ -952,7 +952,7 @@ impl CStore {
952952 }
953953 }
954954
955- fn inject_panic_runtime ( & mut self , krate : & ast :: Crate , tcx : TyCtxt < ' _ > ) {
955+ fn inject_panic_runtime ( & mut self , tcx : TyCtxt < ' _ > , krate : & ast :: Crate ) {
956956 // If we're only compiling an rlib, then there's no need to select a
957957 // panic runtime, so we just skip this section entirely.
958958 let only_rlib = tcx. crate_types ( ) . iter ( ) . all ( |ct| * ct == CrateType :: Rlib ) ;
@@ -992,7 +992,7 @@ impl CStore {
992992 info ! ( "panic runtime not found -- loading {}" , name) ;
993993
994994 let Some ( cnum) =
995- self . resolve_crate ( name, DUMMY_SP , CrateDepKind :: Implicit , CrateOrigin :: Injected , tcx )
995+ self . resolve_crate ( tcx , name, DUMMY_SP , CrateDepKind :: Implicit , CrateOrigin :: Injected )
996996 else {
997997 return ;
998998 } ;
@@ -1022,7 +1022,7 @@ impl CStore {
10221022
10231023 let name = Symbol :: intern ( & tcx. sess . opts . unstable_opts . profiler_runtime ) ;
10241024 let Some ( cnum) =
1025- self . resolve_crate ( name, DUMMY_SP , CrateDepKind :: Implicit , CrateOrigin :: Injected , tcx )
1025+ self . resolve_crate ( tcx , name, DUMMY_SP , CrateDepKind :: Implicit , CrateOrigin :: Injected )
10261026 else {
10271027 return ;
10281028 } ;
@@ -1034,7 +1034,7 @@ impl CStore {
10341034 }
10351035 }
10361036
1037- fn inject_allocator_crate ( & mut self , krate : & ast :: Crate , tcx : TyCtxt < ' _ > ) {
1037+ fn inject_allocator_crate ( & mut self , tcx : TyCtxt < ' _ > , krate : & ast :: Crate ) {
10381038 self . has_global_allocator =
10391039 match & * fn_spans ( krate, Symbol :: intern ( & global_fn_name ( sym:: alloc) ) ) {
10401040 [ span1, span2, ..] => {
@@ -1142,19 +1142,19 @@ impl CStore {
11421142 let name_interned = Symbol :: intern ( name) ;
11431143 if !self . used_extern_options . contains ( & name_interned) {
11441144 self . resolve_crate (
1145+ tcx,
11451146 name_interned,
11461147 DUMMY_SP ,
11471148 CrateDepKind :: Explicit ,
11481149 CrateOrigin :: Extern ,
1149- tcx,
11501150 ) ;
11511151 }
11521152 }
11531153 }
11541154 }
11551155
11561156 /// Inject the `compiler_builtins` crate if it is not already in the graph.
1157- fn inject_compiler_builtins ( & mut self , krate : & ast :: Crate , tcx : TyCtxt < ' _ > ) {
1157+ fn inject_compiler_builtins ( & mut self , tcx : TyCtxt < ' _ > , krate : & ast :: Crate ) {
11581158 // `compiler_builtins` does not get extern builtins, nor do `#![no_core]` crates
11591159 if attr:: contains_name ( & krate. attrs , sym:: compiler_builtins)
11601160 || attr:: contains_name ( & krate. attrs , sym:: no_core)
@@ -1174,11 +1174,11 @@ impl CStore {
11741174
11751175 // `compiler_builtins` is not yet in the graph; inject it. Error on resolution failure.
11761176 let Some ( cnum) = self . resolve_crate (
1177+ tcx,
11771178 sym:: compiler_builtins,
11781179 krate. spans . inner_span . shrink_to_lo ( ) ,
11791180 CrateDepKind :: Explicit ,
11801181 CrateOrigin :: Injected ,
1181- tcx,
11821182 ) else {
11831183 info ! ( "`compiler_builtins` not resolved" ) ;
11841184 return ;
@@ -1191,7 +1191,7 @@ impl CStore {
11911191 }
11921192 }
11931193
1194- fn report_unused_deps_in_crate ( & mut self , krate : & ast :: Crate , tcx : TyCtxt < ' _ > ) {
1194+ fn report_unused_deps_in_crate ( & mut self , tcx : TyCtxt < ' _ > , krate : & ast :: Crate ) {
11951195 // Make a point span rather than covering the whole file
11961196 let span = krate. spans . inner_span . shrink_to_lo ( ) ;
11971197 // Complain about anything left over
@@ -1227,7 +1227,7 @@ impl CStore {
12271227 }
12281228 }
12291229
1230- fn report_future_incompatible_deps ( & self , krate : & ast :: Crate , tcx : TyCtxt < ' _ > ) {
1230+ fn report_future_incompatible_deps ( & self , tcx : TyCtxt < ' _ > , krate : & ast :: Crate ) {
12311231 let name = tcx. crate_name ( LOCAL_CRATE ) ;
12321232
12331233 if name. as_str ( ) == "wasm_bindgen" {
@@ -1260,26 +1260,26 @@ impl CStore {
12601260 }
12611261 }
12621262
1263- pub fn postprocess ( & mut self , krate : & ast :: Crate , tcx : TyCtxt < ' _ > ) {
1264- self . inject_compiler_builtins ( krate , tcx ) ;
1263+ pub fn postprocess ( & mut self , tcx : TyCtxt < ' _ > , krate : & ast :: Crate ) {
1264+ self . inject_compiler_builtins ( tcx , krate ) ;
12651265 self . inject_forced_externs ( tcx) ;
12661266 self . inject_profiler_runtime ( tcx) ;
1267- self . inject_allocator_crate ( krate , tcx ) ;
1268- self . inject_panic_runtime ( krate , tcx ) ;
1267+ self . inject_allocator_crate ( tcx , krate ) ;
1268+ self . inject_panic_runtime ( tcx , krate ) ;
12691269
1270- self . report_unused_deps_in_crate ( krate , tcx ) ;
1271- self . report_future_incompatible_deps ( krate , tcx ) ;
1270+ self . report_unused_deps_in_crate ( tcx , krate ) ;
1271+ self . report_future_incompatible_deps ( tcx , krate ) ;
12721272
12731273 info ! ( "{:?}" , CrateDump ( self ) ) ;
12741274 }
12751275
12761276 /// Process an `extern crate foo` AST node.
12771277 pub fn process_extern_crate (
12781278 & mut self ,
1279+ tcx : TyCtxt < ' _ > ,
12791280 item : & ast:: Item ,
12801281 def_id : LocalDefId ,
12811282 definitions : & Definitions ,
1282- tcx : TyCtxt < ' _ > ,
12831283 ) -> Option < CrateNum > {
12841284 match item. kind {
12851285 ast:: ItemKind :: ExternCrate ( orig_name, ident) => {
@@ -1298,7 +1298,7 @@ impl CStore {
12981298 } ;
12991299
13001300 let cnum =
1301- self . resolve_crate ( name, item. span , dep_kind, CrateOrigin :: Extern , tcx ) ?;
1301+ self . resolve_crate ( tcx , name, item. span , dep_kind, CrateOrigin :: Extern ) ?;
13021302
13031303 let path_len = definitions. def_path ( def_id) . data . len ( ) ;
13041304 self . update_extern_crate (
@@ -1318,12 +1318,12 @@ impl CStore {
13181318
13191319 pub fn process_path_extern (
13201320 & mut self ,
1321+ tcx : TyCtxt < ' _ > ,
13211322 name : Symbol ,
13221323 span : Span ,
1323- tcx : TyCtxt < ' _ > ,
13241324 ) -> Option < CrateNum > {
13251325 let cnum =
1326- self . resolve_crate ( name, span, CrateDepKind :: Explicit , CrateOrigin :: Extern , tcx ) ?;
1326+ self . resolve_crate ( tcx , name, span, CrateDepKind :: Explicit , CrateOrigin :: Extern ) ?;
13271327
13281328 self . update_extern_crate (
13291329 cnum,
@@ -1339,8 +1339,8 @@ impl CStore {
13391339 Some ( cnum)
13401340 }
13411341
1342- pub fn maybe_process_path_extern ( & mut self , name : Symbol , tcx : TyCtxt < ' _ > ) -> Option < CrateNum > {
1343- self . maybe_resolve_crate ( name, CrateDepKind :: Explicit , CrateOrigin :: Extern , tcx ) . ok ( )
1342+ pub fn maybe_process_path_extern ( & mut self , tcx : TyCtxt < ' _ > , name : Symbol ) -> Option < CrateNum > {
1343+ self . maybe_resolve_crate ( tcx , name, CrateDepKind :: Explicit , CrateOrigin :: Extern ) . ok ( )
13441344 }
13451345}
13461346
0 commit comments