@@ -702,15 +702,18 @@ impl<'tcx> DumpVisitor<'tcx> {
702
702
703
703
// super-traits
704
704
for super_bound in trait_refs. iter ( ) {
705
- let trait_ref = match * super_bound {
706
- hir:: GenericBound :: Trait ( ref trait_ref, _) => trait_ref,
705
+ let ( def_id, sub_span) = match * super_bound {
706
+ hir:: GenericBound :: Trait ( ref trait_ref, _) => (
707
+ self . lookup_def_id ( trait_ref. trait_ref . hir_ref_id ) ,
708
+ trait_ref. trait_ref . path . segments . last ( ) . unwrap ( ) . ident . span ,
709
+ ) ,
710
+ hir:: GenericBound :: LangItemTrait ( lang_item, span, _, _) => {
711
+ ( Some ( self . tcx . require_lang_item ( lang_item, Some ( span) ) ) , span)
712
+ }
707
713
hir:: GenericBound :: Outlives ( ..) => continue ,
708
- hir:: GenericBound :: LangItemTrait ( ..) => unimplemented ! ( ) ,
709
714
} ;
710
715
711
- let trait_ref = & trait_ref. trait_ref ;
712
- if let Some ( id) = self . lookup_def_id ( trait_ref. hir_ref_id ) {
713
- let sub_span = trait_ref. path . segments . last ( ) . unwrap ( ) . ident . span ;
716
+ if let Some ( id) = def_id {
714
717
if !self . span . filter_generated ( sub_span) {
715
718
let span = self . span_from_span ( sub_span) ;
716
719
self . dumper . dump_ref ( Ref {
@@ -763,12 +766,7 @@ impl<'tcx> DumpVisitor<'tcx> {
763
766
}
764
767
765
768
fn process_path ( & mut self , id : hir:: HirId , path : & hir:: QPath < ' tcx > ) {
766
- let span = match path {
767
- hir:: QPath :: Resolved ( _, path) => path. span ,
768
- hir:: QPath :: TypeRelative ( _, segment) => segment. ident . span ,
769
- hir:: QPath :: LangItem ( ..) => unimplemented ! ( ) ,
770
- } ;
771
- if self . span . filter_generated ( span) {
769
+ if self . span . filter_generated ( path. span ( ) ) {
772
770
return ;
773
771
}
774
772
self . dump_path_ref ( id, path) ;
@@ -785,7 +783,7 @@ impl<'tcx> DumpVisitor<'tcx> {
785
783
self . visit_ty ( ty) ;
786
784
std:: slice:: from_ref ( * segment)
787
785
}
788
- hir:: QPath :: LangItem ( ..) => unimplemented ! ( ) ,
786
+ hir:: QPath :: LangItem ( ..) => return ,
789
787
} ;
790
788
for seg in segments {
791
789
if let Some ( ref generic_args) = seg. args {
@@ -1358,11 +1356,7 @@ impl<'tcx> Visitor<'tcx> for DumpVisitor<'tcx> {
1358
1356
}
1359
1357
1360
1358
if let Some ( id) = self . lookup_def_id ( t. hir_id ) {
1361
- let sub_span = match path {
1362
- hir:: QPath :: Resolved ( _, path) => path. segments . last ( ) . unwrap ( ) . ident . span ,
1363
- hir:: QPath :: TypeRelative ( _, segment) => segment. ident . span ,
1364
- hir:: QPath :: LangItem ( ..) => unimplemented ! ( ) ,
1365
- } ;
1359
+ let sub_span = path. last_segment_span ( ) ;
1366
1360
let span = self . span_from_span ( sub_span) ;
1367
1361
self . dumper . dump_ref ( Ref {
1368
1362
kind : RefKind :: Type ,
0 commit comments