Skip to content

Commit ddb31de

Browse files
Also get current import attributes
1 parent c003c01 commit ddb31de

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/librustdoc/clean/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -2206,10 +2206,12 @@ fn clean_maybe_renamed_item<'tcx>(
22062206
};
22072207

22082208
let mut extra_attrs = Vec::new();
2209-
if let Some(hir::Node::Item(use_node)) =
2210-
import_id.and_then(|def_id| cx.tcx.hir().find_by_def_id(def_id))
2209+
if let Some(import_id) = import_id &&
2210+
let Some(hir::Node::Item(use_node)) = cx.tcx.hir().find_by_def_id(import_id)
22112211
{
2212-
// We get all the various imports' attributes.
2212+
// First, we add the attributes from the current import.
2213+
extra_attrs.extend_from_slice(inline::load_attrs(cx, import_id.to_def_id()));
2214+
// Then we get all the various imports' attributes.
22132215
get_all_import_attributes(use_node, cx.tcx, item.owner_id.def_id, &mut extra_attrs);
22142216
}
22152217

0 commit comments

Comments
 (0)