about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-02-10 18:32:33 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-02-10 18:32:33 +0100
commitddb31de281d2c1edf2d09b8eb0b6f8e53a13b846 (patch)
treeb6910afe5f5c07404cf057d86a03185a77049923
parentc003c01a03e972d43444862c275836ac12f20a98 (diff)
downloadrust-ddb31de281d2c1edf2d09b8eb0b6f8e53a13b846.tar.gz
rust-ddb31de281d2c1edf2d09b8eb0b6f8e53a13b846.zip
Also get current import attributes
-rw-r--r--src/librustdoc/clean/mod.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 80493b100bb..02e6b0edc72 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2206,10 +2206,12 @@ fn clean_maybe_renamed_item<'tcx>(
         };
 
         let mut extra_attrs = Vec::new();
-        if let Some(hir::Node::Item(use_node)) =
-            import_id.and_then(|def_id| cx.tcx.hir().find_by_def_id(def_id))
+        if let Some(import_id) = import_id &&
+            let Some(hir::Node::Item(use_node)) = cx.tcx.hir().find_by_def_id(import_id)
         {
-            // We get all the various imports' attributes.
+            // First, we add the attributes from the current import.
+            extra_attrs.extend_from_slice(inline::load_attrs(cx, import_id.to_def_id()));
+            // Then we get all the various imports' attributes.
             get_all_import_attributes(use_node, cx.tcx, item.owner_id.def_id, &mut extra_attrs);
         }