@@ -6,6 +6,7 @@ use rustc::hir::def::{Res, DefKind};
66use rustc:: hir:: def_id:: { DefId , LOCAL_CRATE } ;
77use rustc:: middle:: privacy:: AccessLevel ;
88use rustc:: util:: nodemap:: { FxHashSet , FxHashMap } ;
9+ use rustc:: ty:: TyCtxt ;
910use syntax:: ast;
1011use syntax:: ext:: base:: MacroKind ;
1112use syntax:: source_map:: Spanned ;
@@ -18,13 +19,13 @@ use crate::core;
1819use crate :: clean:: { self , AttributesExt , NestedAttributesExt } ;
1920use crate :: doctree:: * ;
2021
22+ // FIXME: Should this be replaced with tcx.def_path_str?
2123fn def_id_to_path (
22- cx : & core :: DocContext < ' _ > ,
24+ tcx : TyCtxt < ' _ > ,
2325 did : DefId ,
24- name : Option < String >
2526) -> Vec < String > {
26- let crate_name = name . unwrap_or_else ( || cx . tcx . crate_name ( did. krate ) . to_string ( ) ) ;
27- let relative = cx . tcx . def_path ( did) . data . into_iter ( ) . filter_map ( |elem| {
27+ let crate_name = tcx. crate_name ( did. krate ) . to_string ( ) ;
28+ let relative = tcx. def_path ( did) . data . into_iter ( ) . filter_map ( |elem| {
2829 // extern blocks have an empty name
2930 let s = elem. data . to_string ( ) ;
3031 if !s. is_empty ( ) {
@@ -68,7 +69,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
6869 // We can't use the entry API, as that keeps the mutable borrow of `self` active
6970 // when we try to use `cx`.
7071 if self . exact_paths . get ( & did) . is_none ( ) {
71- let path = def_id_to_path ( self . cx , did, self . cx . crate_name . clone ( ) ) ;
72+ let path = def_id_to_path ( self . cx . tcx , did) ;
7273 self . exact_paths . insert ( did, path) ;
7374 }
7475 }
0 commit comments