@@ -142,7 +142,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
142142 && sess. crt_static ( Some ( ty) )
143143 && !sess. target . crt_static_allows_dylibs )
144144 {
145- for & cnum in tcx. crates ( ( ) ) . iter ( ) {
145+ for & cnum in tcx. used_crates ( ( ) ) . iter ( ) {
146146 if tcx. dep_kind ( cnum) . macros_only ( ) {
147147 continue ;
148148 }
@@ -163,7 +163,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
163163 // Sweep all crates for found dylibs. Add all dylibs, as well as their
164164 // dependencies, ensuring there are no conflicts. The only valid case for a
165165 // dependency to be relied upon twice is for both cases to rely on a dylib.
166- for & cnum in tcx. crates ( ( ) ) . iter ( ) {
166+ for & cnum in tcx. used_crates ( ( ) ) . iter ( ) {
167167 if tcx. dep_kind ( cnum) . macros_only ( ) {
168168 continue ;
169169 }
@@ -181,7 +181,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
181181 }
182182
183183 // Collect what we've got so far in the return vector.
184- let last_crate = tcx. crates ( ( ) ) . len ( ) ;
184+ let last_crate = tcx. used_crates ( ( ) ) . len ( ) ;
185185 let mut ret = ( 1 ..last_crate + 1 )
186186 . map ( |cnum| match formats. get ( & CrateNum :: new ( cnum) ) {
187187 Some ( & RequireDynamic ) => Linkage :: Dynamic ,
@@ -195,7 +195,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
195195 //
196196 // If the crate hasn't been included yet and it's not actually required
197197 // (e.g., it's an allocator) then we skip it here as well.
198- for & cnum in tcx. crates ( ( ) ) . iter ( ) {
198+ for & cnum in tcx. used_crates ( ( ) ) . iter ( ) {
199199 let src = tcx. used_crate_source ( cnum) ;
200200 if src. dylib . is_none ( )
201201 && !formats. contains_key ( & cnum)
@@ -283,7 +283,7 @@ fn add_library(
283283
284284fn attempt_static ( tcx : TyCtxt < ' _ > , unavailable : & mut Vec < CrateNum > ) -> Option < DependencyList > {
285285 let all_crates_available_as_rlib = tcx
286- . crates ( ( ) )
286+ . used_crates ( ( ) )
287287 . iter ( )
288288 . copied ( )
289289 . filter_map ( |cnum| {
@@ -304,7 +304,7 @@ fn attempt_static(tcx: TyCtxt<'_>, unavailable: &mut Vec<CrateNum>) -> Option<De
304304 // All crates are available in an rlib format, so we're just going to link
305305 // everything in explicitly so long as it's actually required.
306306 let mut ret = tcx
307- . crates ( ( ) )
307+ . used_crates ( ( ) )
308308 . iter ( )
309309 . map ( |& cnum| match tcx. dep_kind ( cnum) {
310310 CrateDepKind :: Explicit => Linkage :: Static ,
0 commit comments