@@ -366,120 +366,6 @@ fn encode_path<PI: Iterator<Item=PathElem>>(rbml_w: &mut Encoder, path: PI) {
366
366
rbml_w. end_tag ( ) ;
367
367
}
368
368
369
- fn encode_reexported_static_method ( rbml_w : & mut Encoder ,
370
- exp : & def:: Export ,
371
- method_def_id : DefId ,
372
- method_name : Name ) {
373
- debug ! ( "(encode reexported static method) {}::{}" ,
374
- exp. name, method_name) ;
375
- rbml_w. start_tag ( tag_items_data_item_reexport) ;
376
- rbml_w. wr_tagged_u64 ( tag_items_data_item_reexport_def_id,
377
- def_to_u64 ( method_def_id) ) ;
378
- rbml_w. wr_tagged_str ( tag_items_data_item_reexport_name,
379
- & format ! ( "{}::{}" , exp. name,
380
- method_name) ) ;
381
- rbml_w. end_tag ( ) ;
382
- }
383
-
384
- fn encode_reexported_static_base_methods ( ecx : & EncodeContext ,
385
- rbml_w : & mut Encoder ,
386
- exp : & def:: Export )
387
- -> bool {
388
- let impl_items = ecx. tcx . impl_items . borrow ( ) ;
389
- match ecx. tcx . inherent_impls . borrow ( ) . get ( & exp. def_id ) {
390
- Some ( implementations) => {
391
- for base_impl_did in implementations. iter ( ) {
392
- for & method_did in impl_items. get ( base_impl_did) . unwrap ( ) {
393
- let impl_item = ecx. tcx . impl_or_trait_item ( method_did. def_id ( ) ) ;
394
- if let ty:: MethodTraitItem ( ref m) = impl_item {
395
- encode_reexported_static_method ( rbml_w,
396
- exp,
397
- m. def_id ,
398
- m. name ) ;
399
- }
400
- }
401
- }
402
-
403
- true
404
- }
405
- None => { false }
406
- }
407
- }
408
-
409
- fn encode_reexported_static_trait_methods ( ecx : & EncodeContext ,
410
- rbml_w : & mut Encoder ,
411
- exp : & def:: Export )
412
- -> bool {
413
- match ecx. tcx . trait_items_cache . borrow ( ) . get ( & exp. def_id ) {
414
- Some ( trait_items) => {
415
- for trait_item in trait_items. iter ( ) {
416
- if let ty:: MethodTraitItem ( ref m) = * trait_item {
417
- encode_reexported_static_method ( rbml_w,
418
- exp,
419
- m. def_id ,
420
- m. name ) ;
421
- }
422
- }
423
- true
424
- }
425
- None => { false }
426
- }
427
- }
428
-
429
- fn encode_reexported_static_methods ( ecx : & EncodeContext ,
430
- rbml_w : & mut Encoder ,
431
- mod_path : PathElems ,
432
- exp : & def:: Export ) {
433
- let exp_node_id = if let Some ( n) = ecx. tcx . map . as_local_node_id ( exp. def_id ) {
434
- n
435
- } else {
436
- // Before the refactor that introducd `as_local_node_id`, we
437
- // were just extracting the node and checking into the
438
- // ast-map. Since the node might have been from another crate,
439
- // this was a tenuous thing to do at best. Anyway, I'm not
440
- // 100% clear on why it's ok to ignore things from other
441
- // crates, but it seems to be what we were doing pre-refactor.
442
- // -nmatsakis
443
- return ;
444
- } ;
445
-
446
- if let Some ( ast_map:: NodeItem ( item) ) = ecx. tcx . map . find ( exp_node_id) {
447
- let path_differs = ecx. tcx . map . with_path ( exp_node_id, |path| {
448
- let ( mut a, mut b) = ( path, mod_path. clone ( ) ) ;
449
- loop {
450
- match ( a. next ( ) , b. next ( ) ) {
451
- ( None , None ) => return true ,
452
- ( None , _) | ( _, None ) => return false ,
453
- ( Some ( x) , Some ( y) ) => if x != y { return false } ,
454
- }
455
- }
456
- } ) ;
457
-
458
- //
459
- // We don't need to reexport static methods on items
460
- // declared in the same module as our `pub use ...` since
461
- // that's done when we encode the item itself.
462
- //
463
- // The only exception is when the reexport *changes* the
464
- // name e.g. `pub use Foo = self::Bar` -- we have
465
- // encoded metadata for static methods relative to Bar,
466
- // but not yet for Foo.
467
- //
468
- if path_differs || item. name != exp. name {
469
- if !encode_reexported_static_base_methods ( ecx, rbml_w, exp) {
470
- if encode_reexported_static_trait_methods ( ecx, rbml_w, exp) {
471
- debug ! ( "(encode reexported static methods) {} [trait]" ,
472
- item. name) ;
473
- }
474
- }
475
- else {
476
- debug ! ( "(encode reexported static methods) {} [base]" ,
477
- item. name) ;
478
- }
479
- }
480
- }
481
- }
482
-
483
369
/// Iterates through "auxiliary node IDs", which are node IDs that describe
484
370
/// top-level items that are sub-items of the given item. Specifically:
485
371
///
@@ -507,8 +393,7 @@ fn each_auxiliary_node_id<F>(item: &hir::Item, callback: F) -> bool where
507
393
508
394
fn encode_reexports ( ecx : & EncodeContext ,
509
395
rbml_w : & mut Encoder ,
510
- id : NodeId ,
511
- path : PathElems ) {
396
+ id : NodeId ) {
512
397
debug ! ( "(encoding info for module) encoding reexports for {}" , id) ;
513
398
match ecx. reexports . get ( & id) {
514
399
Some ( exports) => {
@@ -525,7 +410,6 @@ fn encode_reexports(ecx: &EncodeContext,
525
410
rbml_w. wr_tagged_str ( tag_items_data_item_reexport_name,
526
411
& exp. name . as_str ( ) ) ;
527
412
rbml_w. end_tag ( ) ;
528
- encode_reexported_static_methods ( ecx, rbml_w, path. clone ( ) , exp) ;
529
413
}
530
414
} ,
531
415
None => debug ! ( "(encoding info for module) found no reexports for {}" , id) ,
@@ -576,7 +460,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
576
460
// Encode the reexports of this module, if this module is public.
577
461
if vis == hir:: Public {
578
462
debug ! ( "(encoding info for module) encoding reexports for {}" , id) ;
579
- encode_reexports ( ecx, rbml_w, id, path ) ;
463
+ encode_reexports ( ecx, rbml_w, id) ;
580
464
}
581
465
encode_attributes ( rbml_w, attrs) ;
582
466
@@ -1930,7 +1814,7 @@ fn encode_misc_info(ecx: &EncodeContext,
1930
1814
}
1931
1815
1932
1816
// Encode reexports for the root module.
1933
- encode_reexports ( ecx, rbml_w, 0 , [ ] . iter ( ) . cloned ( ) . chain ( LinkedPath :: empty ( ) ) ) ;
1817
+ encode_reexports ( ecx, rbml_w, 0 ) ;
1934
1818
1935
1819
rbml_w. end_tag ( ) ;
1936
1820
rbml_w. end_tag ( ) ;
0 commit comments