@@ -702,15 +702,18 @@ impl<'tcx> DumpVisitor<'tcx> {
702702
703703 // super-traits
704704 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+ }
707713 hir:: GenericBound :: Outlives ( ..) => continue ,
708- hir:: GenericBound :: LangItemTrait ( ..) => unimplemented ! ( ) ,
709714 } ;
710715
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 {
714717 if !self . span . filter_generated ( sub_span) {
715718 let span = self . span_from_span ( sub_span) ;
716719 self . dumper . dump_ref ( Ref {
@@ -763,12 +766,7 @@ impl<'tcx> DumpVisitor<'tcx> {
763766 }
764767
765768 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 ( ) ) {
772770 return ;
773771 }
774772 self . dump_path_ref ( id, path) ;
@@ -785,7 +783,7 @@ impl<'tcx> DumpVisitor<'tcx> {
785783 self . visit_ty ( ty) ;
786784 std:: slice:: from_ref ( * segment)
787785 }
788- hir:: QPath :: LangItem ( ..) => unimplemented ! ( ) ,
786+ hir:: QPath :: LangItem ( ..) => return ,
789787 } ;
790788 for seg in segments {
791789 if let Some ( ref generic_args) = seg. args {
@@ -1358,11 +1356,7 @@ impl<'tcx> Visitor<'tcx> for DumpVisitor<'tcx> {
13581356 }
13591357
13601358 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 ( ) ;
13661360 let span = self . span_from_span ( sub_span) ;
13671361 self . dumper . dump_ref ( Ref {
13681362 kind : RefKind :: Type ,
0 commit comments