@@ -5770,13 +5770,9 @@ impl<'tcx> ctxt<'tcx> {
57705770 & format ! ( "a default was defined here..." ) ) ;
57715771 }
57725772 ( _, _) => {
5773- let elems = csearch:: get_item_path ( self , expected. def_id )
5774- . into_iter ( )
5775- . map ( |p| p. to_string ( ) )
5776- . collect :: < Vec < _ > > ( ) ;
57775773 self . sess . note (
57785774 & format ! ( "a default is defined on `{}`" ,
5779- elems . join ( "::" ) ) ) ;
5775+ self . item_path_str ( expected . def_id ) ) ) ;
57805776 }
57815777 }
57825778
@@ -5791,13 +5787,9 @@ impl<'tcx> ctxt<'tcx> {
57915787 & format ! ( "a second default was defined here..." ) ) ;
57925788 }
57935789 ( _, _) => {
5794- let elems = csearch:: get_item_path ( self , found. def_id )
5795- . into_iter ( )
5796- . map ( |p| p. to_string ( ) )
5797- . collect :: < Vec < _ > > ( ) ;
5798-
57995790 self . sess . note (
5800- & format ! ( "a second default is defined on `{}`" , elems. join( " " ) ) ) ;
5791+ & format ! ( "a second default is defined on `{}`" ,
5792+ self . item_path_str( found. def_id) ) ) ;
58015793 }
58025794 }
58035795
@@ -6014,6 +6006,14 @@ impl<'tcx> ctxt<'tcx> {
60146006 }
60156007 }
60166008
6009+ pub fn item_name ( & self , id : ast:: DefId ) -> ast:: Name {
6010+ if id. krate == ast:: LOCAL_CRATE {
6011+ self . map . get_path_elem ( id. node ) . name ( )
6012+ } else {
6013+ csearch:: get_item_name ( self , id)
6014+ }
6015+ }
6016+
60176017 /// Returns `(normalized_type, ty)`, where `normalized_type` is the
60186018 /// IntType representation of one of {i64,i32,i16,i8,u64,u32,u16,u8},
60196019 /// and `ty` is the original type (i.e. may include `isize` or
0 commit comments