@@ -442,7 +442,7 @@ pub fn href(did: DefId) -> Option<(String, ItemType, Vec<String>)> {
442442/// Used when rendering a `ResolvedPath` structure. This invokes the `path`
443443/// rendering function with the necessary arguments for linking to a local path.
444444fn resolved_path ( w : & mut fmt:: Formatter , did : DefId , path : & clean:: Path ,
445- print_all : bool , use_absolute : bool ) -> fmt:: Result {
445+ print_all : bool , use_absolute : bool , is_not_debug : bool ) -> fmt:: Result {
446446 let last = path. segments . last ( ) . unwrap ( ) ;
447447 let rel_root = match & * path. segments [ 0 ] . name {
448448 "self" => Some ( "./" . to_string ( ) ) ,
@@ -459,10 +459,14 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path,
459459 } else {
460460 root. push_str ( & seg. name ) ;
461461 root. push_str ( "/" ) ;
462- write ! ( w, "<a class=\" mod\"
463- href=\" {}index.html\" >{}</a>::" ,
464- root,
465- seg. name) ?;
462+ if is_not_debug {
463+ write ! ( w, "<a class=\" mod\"
464+ href=\" {}index.html\" >{}</a>::" ,
465+ root,
466+ seg. name) ?;
467+ } else {
468+ write ! ( w, "{}::" , seg. name) ?;
469+ }
466470 }
467471 }
468472 }
@@ -474,19 +478,37 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path,
474478 }
475479 }
476480 if w. alternate ( ) {
477- write ! ( w, "{:#}{:#}" , HRef :: new( did, & last. name) , last. params) ?;
481+ if is_not_debug {
482+ write ! ( w, "{:#}{:#}" , HRef :: new( did, & last. name) , last. params) ?;
483+ } else {
484+ write ! ( w, "{:?}{:?}" , HRef :: new( did, & last. name) , last. params) ?;
485+ }
478486 } else {
479- let path = if use_absolute {
480- match href ( did) {
481- Some ( ( _, _, fqp) ) => format ! ( "{}::{}" ,
482- fqp[ ..fqp. len( ) -1 ] . join( "::" ) ,
483- HRef :: new( did, fqp. last( ) . unwrap( ) ) ) ,
484- None => format ! ( "{}" , HRef :: new( did, & last. name) ) ,
485- }
487+ if is_not_debug {
488+ let path = if use_absolute {
489+ match href ( did) {
490+ Some ( ( _, _, fqp) ) => format ! ( "{}::{}" ,
491+ fqp[ ..fqp. len( ) -1 ] . join( "::" ) ,
492+ HRef :: new( did, fqp. last( ) . unwrap( ) ) ) ,
493+ None => format ! ( "{}" , HRef :: new( did, & last. name) ) ,
494+ }
495+ } else {
496+ format ! ( "{}" , HRef :: new( did, & last. name) )
497+ } ;
498+ write ! ( w, "{}{}" , path, last. params) ?;
486499 } else {
487- format ! ( "{}" , HRef :: new( did, & last. name) )
488- } ;
489- write ! ( w, "{}{}" , path, last. params) ?;
500+ let path = if use_absolute {
501+ match href ( did) {
502+ Some ( ( _, _, fqp) ) => format ! ( "{:?}::{:?}" ,
503+ fqp[ ..fqp. len( ) -1 ] . join( "::" ) ,
504+ HRef :: new( did, fqp. last( ) . unwrap( ) ) ) ,
505+ None => format ! ( "{:?}" , HRef :: new( did, & last. name) ) ,
506+ }
507+ } else {
508+ format ! ( "{:?}" , HRef :: new( did, & last. name) )
509+ } ;
510+ write ! ( w, "{}{:?}" , path, last. params) ?;
511+ }
490512 }
491513 Ok ( ( ) )
492514}
@@ -570,6 +592,12 @@ impl<'a> fmt::Display for HRef<'a> {
570592 }
571593}
572594
595+ impl < ' a > fmt:: Debug for HRef < ' a > {
596+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
597+ write ! ( f, "{}" , self . text)
598+ }
599+ }
600+
573601fn fmt_type ( t : & clean:: Type , f : & mut fmt:: Formatter , use_absolute : bool ,
574602 is_not_debug : bool ) -> fmt:: Result {
575603 match * t {
@@ -578,7 +606,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool,
578606 }
579607 clean:: ResolvedPath { did, ref typarams, ref path, is_generic } => {
580608 // Paths like T::Output and Self::Output should be rendered with all segments
581- resolved_path ( f, did, path, is_generic, use_absolute) ?;
609+ resolved_path ( f, did, path, is_generic, use_absolute, is_not_debug ) ?;
582610 tybounds ( f, typarams)
583611 }
584612 clean:: Infer => write ! ( f, "_" ) ,
@@ -767,7 +795,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool,
767795 write ! ( f, "{}::" , self_type) ?;
768796 }
769797 let path = clean:: Path :: singleton ( name. clone ( ) ) ;
770- resolved_path ( f, did, & path, true , use_absolute) ?;
798+ resolved_path ( f, did, & path, true , use_absolute, is_not_debug ) ?;
771799
772800 // FIXME: `typarams` are not rendered, and this seems bad?
773801 drop ( typarams) ;
@@ -1051,7 +1079,7 @@ impl fmt::Display for clean::Import {
10511079impl fmt:: Display for clean:: ImportSource {
10521080 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10531081 match self . did {
1054- Some ( did) => resolved_path ( f, did, & self . path , true , false ) ,
1082+ Some ( did) => resolved_path ( f, did, & self . path , true , false , true ) ,
10551083 _ => {
10561084 for ( i, seg) in self . path . segments . iter ( ) . enumerate ( ) {
10571085 if i > 0 {
0 commit comments