@@ -142,7 +142,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
142
142
&& sess. crt_static ( Some ( ty) )
143
143
&& !sess. target . crt_static_allows_dylibs )
144
144
{
145
- for & cnum in tcx. crates ( ( ) ) . iter ( ) {
145
+ for & cnum in tcx. used_crates ( ( ) ) . iter ( ) {
146
146
if tcx. dep_kind ( cnum) . macros_only ( ) {
147
147
continue ;
148
148
}
@@ -163,7 +163,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
163
163
// Sweep all crates for found dylibs. Add all dylibs, as well as their
164
164
// dependencies, ensuring there are no conflicts. The only valid case for a
165
165
// 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 ( ) {
167
167
if tcx. dep_kind ( cnum) . macros_only ( ) {
168
168
continue ;
169
169
}
@@ -181,7 +181,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
181
181
}
182
182
183
183
// 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 ( ) ;
185
185
let mut ret = ( 1 ..last_crate + 1 )
186
186
. map ( |cnum| match formats. get ( & CrateNum :: new ( cnum) ) {
187
187
Some ( & RequireDynamic ) => Linkage :: Dynamic ,
@@ -195,7 +195,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
195
195
//
196
196
// If the crate hasn't been included yet and it's not actually required
197
197
// (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 ( ) {
199
199
let src = tcx. used_crate_source ( cnum) ;
200
200
if src. dylib . is_none ( )
201
201
&& !formats. contains_key ( & cnum)
@@ -283,7 +283,7 @@ fn add_library(
283
283
284
284
fn attempt_static ( tcx : TyCtxt < ' _ > , unavailable : & mut Vec < CrateNum > ) -> Option < DependencyList > {
285
285
let all_crates_available_as_rlib = tcx
286
- . crates ( ( ) )
286
+ . used_crates ( ( ) )
287
287
. iter ( )
288
288
. copied ( )
289
289
. filter_map ( |cnum| {
@@ -304,7 +304,7 @@ fn attempt_static(tcx: TyCtxt<'_>, unavailable: &mut Vec<CrateNum>) -> Option<De
304
304
// All crates are available in an rlib format, so we're just going to link
305
305
// everything in explicitly so long as it's actually required.
306
306
let mut ret = tcx
307
- . crates ( ( ) )
307
+ . used_crates ( ( ) )
308
308
. iter ( )
309
309
. map ( |& cnum| match tcx. dep_kind ( cnum) {
310
310
CrateDepKind :: Explicit => Linkage :: Static ,
0 commit comments