@@ -451,7 +451,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
451
451
// 2. For an extern inferred from a path or an indirect crate,
452
452
// where there is no explicit `extern crate`, we just prepend
453
453
// the crate name.
454
- match self . tcx ( ) . extern_crate ( def_id ) {
454
+ match self . tcx ( ) . extern_crate ( cnum ) {
455
455
Some ( & ExternCrate { src, dependency_of, span, .. } ) => match ( src, dependency_of) {
456
456
( ExternCrateSource :: Extern ( def_id) , LOCAL_CRATE ) => {
457
457
// NOTE(eddyb) the only reason `span` might be dummy,
@@ -3247,10 +3247,8 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N
3247
3247
let mut seen_defs: DefIdSet = Default :: default ( ) ;
3248
3248
3249
3249
for & cnum in tcx. crates ( ( ) ) . iter ( ) {
3250
- let def_id = cnum. as_def_id ( ) ;
3251
-
3252
3250
// Ignore crates that are not direct dependencies.
3253
- match tcx. extern_crate ( def_id ) {
3251
+ match tcx. extern_crate ( cnum ) {
3254
3252
None => continue ,
3255
3253
Some ( extern_crate) => {
3256
3254
if !extern_crate. is_direct ( ) {
@@ -3259,7 +3257,7 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N
3259
3257
}
3260
3258
}
3261
3259
3262
- queue. push ( def_id ) ;
3260
+ queue. push ( cnum . as_def_id ( ) ) ;
3263
3261
}
3264
3262
3265
3263
// Iterate external crate defs but be mindful about visibility
0 commit comments