@@ -5770,13 +5770,9 @@ impl<'tcx> ctxt<'tcx> {
5770
5770
& format ! ( "a default was defined here..." ) ) ;
5771
5771
}
5772
5772
( _, _) => {
5773
- let elems = csearch:: get_item_path ( self , expected. def_id )
5774
- . into_iter ( )
5775
- . map ( |p| p. to_string ( ) )
5776
- . collect :: < Vec < _ > > ( ) ;
5777
5773
self . sess . note (
5778
5774
& format ! ( "a default is defined on `{}`" ,
5779
- elems . join ( "::" ) ) ) ;
5775
+ self . item_path_str ( expected . def_id ) ) ) ;
5780
5776
}
5781
5777
}
5782
5778
@@ -5791,13 +5787,9 @@ impl<'tcx> ctxt<'tcx> {
5791
5787
& format ! ( "a second default was defined here..." ) ) ;
5792
5788
}
5793
5789
( _, _) => {
5794
- let elems = csearch:: get_item_path ( self , found. def_id )
5795
- . into_iter ( )
5796
- . map ( |p| p. to_string ( ) )
5797
- . collect :: < Vec < _ > > ( ) ;
5798
-
5799
5790
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) ) ) ;
5801
5793
}
5802
5794
}
5803
5795
@@ -6014,6 +6006,14 @@ impl<'tcx> ctxt<'tcx> {
6014
6006
}
6015
6007
}
6016
6008
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
+
6017
6017
/// Returns `(normalized_type, ty)`, where `normalized_type` is the
6018
6018
/// IntType representation of one of {i64,i32,i16,i8,u64,u32,u16,u8},
6019
6019
/// and `ty` is the original type (i.e. may include `isize` or
0 commit comments