@@ -759,35 +759,35 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
759759 /// # Examples
760760 ///
761761 /// ```rust,ignore (no context or def id available)
762- /// if cx.match_def_path(def_id, &[" core", " option", " Option" ]) {
762+ /// if cx.match_def_path(def_id, &[sym:: core, sym:: option, sym:: Option]) {
763763 /// // The given `def_id` is that of an `Option` type
764764 /// }
765765 /// ```
766- pub fn match_def_path ( & self , def_id : DefId , path : & [ & str ] ) -> bool {
766+ pub fn match_def_path ( & self , def_id : DefId , path : & [ Symbol ] ) -> bool {
767767 let names = self . get_def_path ( def_id) ;
768768
769- names. len ( ) == path. len ( ) && names. into_iter ( ) . zip ( path. iter ( ) ) . all ( |( a, & b) | * a == * b)
769+ names. len ( ) == path. len ( ) && names. into_iter ( ) . zip ( path. iter ( ) ) . all ( |( a, & b) | a == b)
770770 }
771771
772- /// Gets the absolute path of `def_id` as a vector of `&str `.
772+ /// Gets the absolute path of `def_id` as a vector of `Symbol `.
773773 ///
774774 /// # Examples
775775 ///
776776 /// ```rust,ignore (no context or def id available)
777777 /// let def_path = cx.get_def_path(def_id);
778- /// if let &[" core", " option", " Option" ] = &def_path[..] {
778+ /// if let &[sym:: core, sym:: option, sym:: Option] = &def_path[..] {
779779 /// // The given `def_id` is that of an `Option` type
780780 /// }
781781 /// ```
782- pub fn get_def_path ( & self , def_id : DefId ) -> Vec < LocalInternedString > {
782+ pub fn get_def_path ( & self , def_id : DefId ) -> Vec < Symbol > {
783783 pub struct AbsolutePathPrinter < ' a , ' tcx > {
784784 pub tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
785785 }
786786
787787 impl < ' tcx > Printer < ' tcx , ' tcx > for AbsolutePathPrinter < ' _ , ' tcx > {
788788 type Error = !;
789789
790- type Path = Vec < LocalInternedString > ;
790+ type Path = Vec < Symbol > ;
791791 type Region = ( ) ;
792792 type Type = ( ) ;
793793 type DynExistential = ( ) ;
@@ -820,14 +820,14 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
820820 }
821821
822822 fn path_crate ( self , cnum : CrateNum ) -> Result < Self :: Path , Self :: Error > {
823- Ok ( vec ! [ self . tcx. original_crate_name( cnum) . as_str ( ) ] )
823+ Ok ( vec ! [ self . tcx. original_crate_name( cnum) ] )
824824 }
825825
826826 fn path_qualified (
827827 self ,
828828 self_ty : Ty < ' tcx > ,
829829 trait_ref : Option < ty:: TraitRef < ' tcx > > ,
830- ) -> Result < Self :: Path , Self :: Error > {
830+ ) -> Result < Self :: Path , Self :: Error > {
831831 if trait_ref. is_none ( ) {
832832 if let ty:: Adt ( def, substs) = self_ty. sty {
833833 return self . print_def_path ( def. did , substs) ;
@@ -836,8 +836,8 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
836836
837837 // This shouldn't ever be needed, but just in case:
838838 Ok ( vec ! [ match trait_ref {
839- Some ( trait_ref) => LocalInternedString :: intern( & format!( "{:?}" , trait_ref) ) ,
840- None => LocalInternedString :: intern( & format!( "<{}>" , self_ty) ) ,
839+ Some ( trait_ref) => Symbol :: intern( & format!( "{:?}" , trait_ref) ) ,
840+ None => Symbol :: intern( & format!( "<{}>" , self_ty) ) ,
841841 } ] )
842842 }
843843
@@ -847,16 +847,16 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
847847 _disambiguated_data : & DisambiguatedDefPathData ,
848848 self_ty : Ty < ' tcx > ,
849849 trait_ref : Option < ty:: TraitRef < ' tcx > > ,
850- ) -> Result < Self :: Path , Self :: Error > {
850+ ) -> Result < Self :: Path , Self :: Error > {
851851 let mut path = print_prefix ( self ) ?;
852852
853853 // This shouldn't ever be needed, but just in case:
854854 path. push ( match trait_ref {
855855 Some ( trait_ref) => {
856- LocalInternedString :: intern ( & format ! ( "<impl {} for {}>" , trait_ref,
856+ Symbol :: intern ( & format ! ( "<impl {} for {}>" , trait_ref,
857857 self_ty) )
858858 } ,
859- None => LocalInternedString :: intern ( & format ! ( "<impl {}>" , self_ty) ) ,
859+ None => Symbol :: intern ( & format ! ( "<impl {}>" , self_ty) ) ,
860860 } ) ;
861861
862862 Ok ( path)
@@ -866,7 +866,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
866866 self ,
867867 print_prefix : impl FnOnce ( Self ) -> Result < Self :: Path , Self :: Error > ,
868868 disambiguated_data : & DisambiguatedDefPathData ,
869- ) -> Result < Self :: Path , Self :: Error > {
869+ ) -> Result < Self :: Path , Self :: Error > {
870870 let mut path = print_prefix ( self ) ?;
871871
872872 // Skip `::{{constructor}}` on tuple/unit structs.
@@ -875,15 +875,15 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
875875 _ => { }
876876 }
877877
878- path. push ( disambiguated_data. data . as_interned_str ( ) . as_str ( ) ) ;
878+ path. push ( disambiguated_data. data . as_interned_str ( ) . as_symbol ( ) ) ;
879879 Ok ( path)
880880 }
881881
882882 fn path_generic_args (
883883 self ,
884884 print_prefix : impl FnOnce ( Self ) -> Result < Self :: Path , Self :: Error > ,
885885 _args : & [ Kind < ' tcx > ] ,
886- ) -> Result < Self :: Path , Self :: Error > {
886+ ) -> Result < Self :: Path , Self :: Error > {
887887 print_prefix ( self )
888888 }
889889 }
0 commit comments