about summary refs log tree commit diff
path: root/src/librustdoc/html/render/cache.rs
diff options
context:
space:
mode:
authorTimothée Delabrouille <timothee.delabrouille@musicworldmedia.com>2021-04-23 22:15:13 +0200
committerTimothée Delabrouille <timothee.delabrouille@musicworldmedia.com>2021-04-27 10:17:59 +0200
commitb4f1dfd2c57985a4cbb74fb34073ba04fd6f5f63 (patch)
tree574a6b0f39e26251ab3354f22d86575146726755 /src/librustdoc/html/render/cache.rs
parent5da10c01214a3d3ebec65b8ba6effada92a0673f (diff)
downloadrust-b4f1dfd2c57985a4cbb74fb34073ba04fd6f5f63.tar.gz
rust-b4f1dfd2c57985a4cbb74fb34073ba04fd6f5f63.zip
Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of the fields in Attributes, as functions in AttributesExt.
refacto use from_def_id_and_attrs_and_parts instead of an old trick

most of josha suggestions + check if def_id is not fake before using it in a query

Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of the Attributes fields as functions in AttributesExt.
Diffstat (limited to 'src/librustdoc/html/render/cache.rs')
-rw-r--r--src/librustdoc/html/render/cache.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs
index f93a0d4fc2d..d1aa6fba463 100644
--- a/src/librustdoc/html/render/cache.rs
+++ b/src/librustdoc/html/render/cache.rs
@@ -1,15 +1,17 @@
 use std::collections::BTreeMap;
 use std::path::Path;
 
+use rustc_ast::ast;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_middle::ty::TyCtxt;
 use rustc_span::symbol::{sym, Symbol};
 use serde::ser::{Serialize, SerializeStruct, Serializer};
 
+use crate::clean;
 use crate::clean::types::{
-    FnDecl, FnRetTy, GenericBound, Generics, GetDefId, Type, WherePredicate,
+    AttributesExt, FnDecl, FnRetTy, GenericBound, Generics, GetDefId, Type, TypeKind,
+    WherePredicate,
 };
-use crate::clean::{self, AttributesExt};
 use crate::formats::cache::Cache;
 use crate::formats::item_type::ItemType;
 use crate::html::markdown::short_markdown_summary;
@@ -30,6 +32,7 @@ crate enum ExternalLocation {
 crate fn extern_location(
     e: &clean::ExternalCrate,
     extern_url: Option<&str>,
+    ast_attrs: &[ast::Attribute],
     dst: &Path,
     tcx: TyCtxt<'_>,
 ) -> ExternalLocation {
@@ -50,7 +53,7 @@ crate fn extern_location(
 
     // Failing that, see if there's an attribute specifying where to find this
     // external crate
-    e.attrs
+    ast_attrs
         .lists(sym::doc)
         .filter(|a| a.has_name(sym::html_root_url))
         .filter_map(|a| a.value_str())