@@ -304,17 +304,7 @@ pub fn provide(providers: &mut Providers) {
304
304
// traversal, but not globally minimal across all crates.
305
305
let bfs_queue = & mut VecDeque :: new ( ) ;
306
306
307
- // Preferring shortest paths alone does not guarantee a
308
- // deterministic result; so sort by crate num to avoid
309
- // hashtable iteration non-determinism. This only makes
310
- // things as deterministic as crate-nums assignment is,
311
- // which is to say, its not deterministic in general. But
312
- // we believe that libstd is consistently assigned crate
313
- // num 1, so it should be enough to resolve #46112.
314
- let mut crates: Vec < CrateNum > = ( * tcx. crates ( ( ) ) ) . to_owned ( ) ;
315
- crates. sort ( ) ;
316
-
317
- for & cnum in crates. iter ( ) {
307
+ for & cnum in tcx. crates ( ( ) ) {
318
308
// Ignore crates without a corresponding local `extern crate` item.
319
309
if tcx. missing_extern_crate_item ( cnum) {
320
310
continue ;
@@ -323,35 +313,31 @@ pub fn provide(providers: &mut Providers) {
323
313
bfs_queue. push_back ( DefId { krate : cnum, index : CRATE_DEF_INDEX } ) ;
324
314
}
325
315
326
- // (restrict scope of mutable-borrow of `visible_parent_map`)
327
- {
328
- let visible_parent_map = & mut visible_parent_map;
329
- let mut add_child = |bfs_queue : & mut VecDeque < _ > , child : & Export , parent : DefId | {
330
- if child. vis != ty:: Visibility :: Public {
331
- return ;
332
- }
316
+ let mut add_child = |bfs_queue : & mut VecDeque < _ > , child : & Export , parent : DefId | {
317
+ if child. vis != ty:: Visibility :: Public {
318
+ return ;
319
+ }
333
320
334
- if let Some ( child) = child. res . opt_def_id ( ) {
335
- match visible_parent_map. entry ( child) {
336
- Entry :: Occupied ( mut entry) => {
337
- // If `child` is defined in crate `cnum`, ensure
338
- // that it is mapped to a parent in `cnum`.
339
- if child. is_local ( ) && entry. get ( ) . is_local ( ) {
340
- entry. insert ( parent) ;
341
- }
342
- }
343
- Entry :: Vacant ( entry) => {
321
+ if let Some ( child) = child. res . opt_def_id ( ) {
322
+ match visible_parent_map. entry ( child) {
323
+ Entry :: Occupied ( mut entry) => {
324
+ // If `child` is defined in crate `cnum`, ensure
325
+ // that it is mapped to a parent in `cnum`.
326
+ if child. is_local ( ) && entry. get ( ) . is_local ( ) {
344
327
entry. insert ( parent) ;
345
- bfs_queue. push_back ( child) ;
346
328
}
347
329
}
330
+ Entry :: Vacant ( entry) => {
331
+ entry. insert ( parent) ;
332
+ bfs_queue. push_back ( child) ;
333
+ }
348
334
}
349
- } ;
335
+ }
336
+ } ;
350
337
351
- while let Some ( def) = bfs_queue. pop_front ( ) {
352
- for child in tcx. item_children ( def) . iter ( ) {
353
- add_child ( bfs_queue, child, def) ;
354
- }
338
+ while let Some ( def) = bfs_queue. pop_front ( ) {
339
+ for child in tcx. item_children ( def) . iter ( ) {
340
+ add_child ( bfs_queue, child, def) ;
355
341
}
356
342
}
357
343
0 commit comments