@@ -143,7 +143,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
143143 && sess. crt_static ( Some ( ty) )
144144 && !sess. target . crt_static_allows_dylibs )
145145 {
146- for & cnum in tcx. crates ( ( ) ) . iter ( ) {
146+ for & cnum in tcx. used_crates ( ( ) ) . iter ( ) {
147147 if tcx. dep_kind ( cnum) . macros_only ( ) {
148148 continue ;
149149 }
@@ -164,7 +164,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
164164 // Sweep all crates for found dylibs. Add all dylibs, as well as their
165165 // dependencies, ensuring there are no conflicts. The only valid case for a
166166 // dependency to be relied upon twice is for both cases to rely on a dylib.
167- for & cnum in tcx. crates ( ( ) ) . iter ( ) {
167+ for & cnum in tcx. used_crates ( ( ) ) . iter ( ) {
168168 if tcx. dep_kind ( cnum) . macros_only ( ) {
169169 continue ;
170170 }
@@ -182,7 +182,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
182182 }
183183
184184 // Collect what we've got so far in the return vector.
185- let last_crate = tcx. crates ( ( ) ) . len ( ) ;
185+ let last_crate = tcx. used_crates ( ( ) ) . len ( ) ;
186186 let mut ret = ( 1 ..last_crate + 1 )
187187 . map ( |cnum| match formats. get ( & CrateNum :: new ( cnum) ) {
188188 Some ( & RequireDynamic ) => Linkage :: Dynamic ,
@@ -196,7 +196,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
196196 //
197197 // If the crate hasn't been included yet and it's not actually required
198198 // (e.g., it's an allocator) then we skip it here as well.
199- for & cnum in tcx. crates ( ( ) ) . iter ( ) {
199+ for & cnum in tcx. used_crates ( ( ) ) . iter ( ) {
200200 let src = tcx. used_crate_source ( cnum) ;
201201 if src. dylib . is_none ( )
202202 && !formats. contains_key ( & cnum)
@@ -284,7 +284,7 @@ fn add_library(
284284
285285fn attempt_static ( tcx : TyCtxt < ' _ > , unavailable : & mut Vec < CrateNum > ) -> Option < DependencyList > {
286286 let all_crates_available_as_rlib = tcx
287- . crates ( ( ) )
287+ . used_crates ( ( ) )
288288 . iter ( )
289289 . copied ( )
290290 . filter_map ( |cnum| {
@@ -305,7 +305,7 @@ fn attempt_static(tcx: TyCtxt<'_>, unavailable: &mut Vec<CrateNum>) -> Option<De
305305 // All crates are available in an rlib format, so we're just going to link
306306 // everything in explicitly so long as it's actually required.
307307 let mut ret = tcx
308- . crates ( ( ) )
308+ . used_crates ( ( ) )
309309 . iter ( )
310310 . map ( |& cnum| match tcx. dep_kind ( cnum) {
311311 CrateDepKind :: Explicit => Linkage :: Static ,
0 commit comments