about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorTor Hovland <tor.hovland@bekk.no>2021-04-19 20:39:04 +0200
committerTor Hovland <tor.hovland@bekk.no>2021-04-19 20:39:04 +0200
commit64a68ae69adf508c73e642ff8739d3e547878467 (patch)
tree1209999e6a414bd7c358e1c7a52c3223d473181c /src/librustdoc/html/render
parentc975fe25e4b5756b03033e4819a5c5044ca353f2 (diff)
downloadrust-64a68ae69adf508c73e642ff8739d3e547878467.tar.gz
rust-64a68ae69adf508c73e642ff8739d3e547878467.zip
No longer need to add attrs to ImportSource.
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/print_item.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index d941095e5e1..a303ca956d8 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -4,6 +4,7 @@ use rustc_data_structures::fx::FxHashMap;
 use rustc_hir as hir;
 use rustc_hir::def::CtorKind;
 use rustc_hir::def_id::DefId;
+use rustc_middle::dep_graph::DepContext;
 use rustc_middle::middle::stability;
 use rustc_middle::ty::TyCtxt;
 use rustc_span::hygiene::MacroKind;
@@ -282,11 +283,19 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
             }
 
             clean::ImportItem(ref import) => {
-                let (stab, stab_tags) = if let (Some(def_id), Some(attrs)) =
-                    (import.source.did, import.source.attrs.clone())
-                {
+                let (stab, stab_tags) = if let Some(import_def_id) = import.source.did {
+                    let import_attrs = Box::new(clean::Attributes::from_ast(
+                        cx.tcx().sess().diagnostic(),
+                        cx.tcx().get_attrs(import_def_id),
+                        None,
+                    ));
+
                     // Just need an item with the correct def_id and attrs
-                    let import_item = clean::Item { def_id, attrs, ..myitem.clone() };
+                    let import_item = clean::Item {
+                        def_id: import_def_id,
+                        attrs: import_attrs,
+                        ..myitem.clone()
+                    };
 
                     let stab = import_item.stability_class(cx.tcx());
                     let stab_tags = Some(extra_info_tags(&import_item, item, cx.tcx()));