@@ -244,27 +244,27 @@ impl<'tcx> ImplOrTraitItem<'tcx> {
244244 match node. span ( ) {
245245 Some ( span) => match tcx. sess . codemap ( ) . span_to_oneline_snippet ( span) {
246246 Ok ( snippet) => snippet,
247- Err ( _) => item. signature ( ) ,
247+ Err ( _) => item. signature ( tcx ) ,
248248 } ,
249- None => item. signature ( ) ,
249+ None => item. signature ( tcx ) ,
250250 }
251251 }
252- None => item. signature ( ) ,
252+ None => item. signature ( tcx ) ,
253253 }
254254 }
255- TypeTraitItem ( ref item) => item. signature ( ) ,
255+ TypeTraitItem ( ref item) => item. signature ( tcx ) ,
256256 ConstTraitItem ( ref item) => {
257257 match tcx. map . get_if_local ( item. def_id ) {
258258 Some ( node) => {
259259 match node. span ( ) {
260260 Some ( span) => match tcx. sess . codemap ( ) . span_to_oneline_snippet ( span) {
261261 Ok ( snippet) => snippet,
262- Err ( _) => item. signature ( ) ,
262+ Err ( _) => item. signature ( tcx ) ,
263263 } ,
264- None => item. signature ( ) ,
264+ None => item. signature ( tcx ) ,
265265 }
266266 }
267- None => item. signature ( ) ,
267+ None => item. signature ( tcx ) ,
268268 }
269269 }
270270 }
@@ -362,7 +362,7 @@ impl<'tcx> Method<'tcx> {
362362 }
363363 }
364364
365- pub fn signature ( & self ) -> String {
365+ pub fn signature < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> String {
366366 let name = self . name . to_string ( ) ;
367367 let unsafety = match self . fty . unsafety {
368368 hir:: Unsafety :: Unsafe => "unsafe " ,
@@ -379,6 +379,7 @@ impl<'tcx> Method<'tcx> {
379379 } ;
380380 let args = self . fty . sig . inputs ( ) . 0 . iter ( )
381381 . map ( |t| format ! ( "{:?}" , t) ) . collect :: < Vec < _ > > ( ) . join ( ", " ) ;
382+ //let return_type = format!("{}", tcx.item_name(self.fty.sig.output().0.def_id).as_str());
382383 let return_type = format ! ( "{:?}" , self . fty. sig. output( ) . 0 ) ;
383384 let return_signature = if & return_type == "()" {
384385 "" . to_string ( )
@@ -387,7 +388,8 @@ impl<'tcx> Method<'tcx> {
387388 } ;
388389
389390 // unsafe fn name<'a, T>(args) -> ReturnType
390- format ! ( "{}fn {}{}({}){};" , unsafety, name, type_args, args, return_signature)
391+ //format!("{}fn {}{}({}){};", unsafety, name, type_args, args, return_signature)
392+ format ! ( "{}fn {}" , unsafety, self . fty. sig. 0 ) //name, type_args, args, return_signature)
391393 }
392394}
393395
@@ -417,13 +419,14 @@ pub struct AssociatedConst<'tcx> {
417419}
418420
419421impl < ' tcx > AssociatedConst < ' tcx > {
420- pub fn signature ( & self ) -> String {
422+ pub fn signature < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> String {
421423 // const FOO: Type = DEFAULT;
422424 let value = if self . has_value {
423425 " = <DEFAULT>"
424426 } else {
425427 ""
426428 } ;
429+ //format!("const {}: {}{};", self.name.to_string(), tcx.item_name(self.ty.def_id).as_str(), value)
427430 format ! ( "const {}: {:?}{};" , self . name. to_string( ) , self . ty, value)
428431 }
429432}
@@ -439,7 +442,7 @@ pub struct AssociatedType<'tcx> {
439442}
440443
441444impl < ' tcx > AssociatedType < ' tcx > {
442- pub fn signature ( & self ) -> String {
445+ pub fn signature < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> String {
443446 //// type Type;
444447 format ! ( "type {};" , self . name. to_string( ) )
445448 }
0 commit comments