Remove name
field from ExternalCrate
This commit is contained in:
parent
5407a69aa4
commit
3bef65ffaf
5 changed files with 12 additions and 7 deletions
|
@ -194,7 +194,6 @@ impl Clean<ExternalCrate> for CrateNum {
|
|||
|
||||
ExternalCrate {
|
||||
crate_num: *self,
|
||||
name: tcx.crate_name(*self),
|
||||
attrs: tcx.get_attrs(root).clean(cx),
|
||||
primitives,
|
||||
keywords,
|
||||
|
|
|
@ -73,7 +73,6 @@ crate struct TraitWithExtraInfo {
|
|||
#[derive(Clone, Debug)]
|
||||
crate struct ExternalCrate {
|
||||
crate crate_num: CrateNum,
|
||||
crate name: Symbol,
|
||||
crate attrs: Attributes,
|
||||
crate primitives: ThinVec<(DefId, PrimitiveType)>,
|
||||
crate keywords: ThinVec<(DefId, Symbol)>,
|
||||
|
@ -85,6 +84,10 @@ impl ExternalCrate {
|
|||
let krate_span = tcx.def_span(root);
|
||||
tcx.sess.source_map().span_to_filename(krate_span)
|
||||
}
|
||||
|
||||
crate fn name(&self, tcx: TyCtxt<'_>) -> Symbol {
|
||||
tcx.crate_name(self.crate_num)
|
||||
}
|
||||
}
|
||||
|
||||
/// Anything with a source location and set of attributes and, optionally, a
|
||||
|
|
|
@ -56,7 +56,8 @@ crate fn krate(cx: &mut DocContext<'_>) -> Crate {
|
|||
|
||||
let local_crate = LOCAL_CRATE.clean(cx);
|
||||
let src = local_crate.src(cx.tcx);
|
||||
let ExternalCrate { name, primitives, keywords, .. } = local_crate;
|
||||
let name = local_crate.name(cx.tcx);
|
||||
let ExternalCrate { primitives, keywords, .. } = local_crate;
|
||||
{
|
||||
let m = match *module.kind {
|
||||
ItemKind::ModuleItem(ref mut m) => m,
|
||||
|
|
|
@ -162,12 +162,13 @@ impl Cache {
|
|||
},
|
||||
_ => PathBuf::new(),
|
||||
};
|
||||
let extern_url = extern_html_root_urls.get(&*e.name.as_str()).map(|u| &**u);
|
||||
let name = e.name(tcx);
|
||||
let extern_url = extern_html_root_urls.get(&*name.as_str()).map(|u| &**u);
|
||||
self.extern_locations
|
||||
.insert(n, (e.name, src_root, extern_location(e, extern_url, &dst)));
|
||||
.insert(n, (name, src_root, extern_location(e, extern_url, &dst, tcx)));
|
||||
|
||||
let did = DefId { krate: n, index: CRATE_DEF_INDEX };
|
||||
self.external_paths.insert(did, (vec![e.name.to_string()], ItemType::Module));
|
||||
self.external_paths.insert(did, (vec![name.to_string()], ItemType::Module));
|
||||
}
|
||||
|
||||
// Cache where all known primitives have their documentation located.
|
||||
|
|
|
@ -31,10 +31,11 @@ crate fn extern_location(
|
|||
e: &clean::ExternalCrate,
|
||||
extern_url: Option<&str>,
|
||||
dst: &Path,
|
||||
tcx: TyCtxt<'_>,
|
||||
) -> ExternalLocation {
|
||||
use ExternalLocation::*;
|
||||
// See if there's documentation generated into the local directory
|
||||
let local_location = dst.join(&*e.name.as_str());
|
||||
let local_location = dst.join(&*e.name(tcx).as_str());
|
||||
if local_location.is_dir() {
|
||||
return Local;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue