diff options
| author | bors <bors@rust-lang.org> | 2020-12-11 22:00:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-12-11 22:00:00 +0000 |
| commit | 9eb3a7ceafd1e2c1924177caa18c7cc0c25b413e (patch) | |
| tree | a68004e4e691ad675d5faa8ef2722ecfd13ba126 /src/librustdoc/clean/inline.rs | |
| parent | 2225ee1b62ff089917434aefd9b2bf509cfa087f (diff) | |
| parent | d93f1d6c04fab017a24d868dd766a290321e636c (diff) | |
| download | rust-9eb3a7ceafd1e2c1924177caa18c7cc0c25b413e.tar.gz rust-9eb3a7ceafd1e2c1924177caa18c7cc0c25b413e.zip | |
Auto merge of #79349 - Nemo157:issue-79201, r=jyn514
Apply `doc(cfg)` from parent items while collecting trait impls Because trait impls bypass the standard `clean` hierarchy they do not participate in the `propagate_doc_cfg` pass, so instead we need to pre-collect all possible `doc(cfg)` attributes that will apply to them when cleaning. fixes #79201
Diffstat (limited to 'src/librustdoc/clean/inline.rs')
| -rw-r--r-- | src/librustdoc/clean/inline.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index f3067360f06..cef0e36505c 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -339,9 +339,6 @@ crate fn build_impl( return; } - let attrs = merge_attrs(cx, parent_module.into(), load_attrs(cx, did), attrs); - debug!("merged_attrs={:?}", attrs); - let tcx = cx.tcx; let associated_trait = tcx.impl_trait_ref(did); @@ -435,7 +432,7 @@ crate fn build_impl( debug!("build_impl: impl {:?} for {:?}", trait_.def_id(), for_.def_id()); - ret.push(clean::Item::from_def_id_and_parts( + let mut item = clean::Item::from_def_id_and_parts( did, None, clean::ImplItem(clean::Impl { @@ -450,7 +447,10 @@ crate fn build_impl( blanket_impl: None, }), cx, - )); + ); + item.attrs = merge_attrs(cx, parent_module.into(), load_attrs(cx, did), attrs); + debug!("merged_attrs={:?}", item.attrs); + ret.push(item); } fn build_module(cx: &DocContext<'_>, did: DefId, visited: &mut FxHashSet<DefId>) -> clean::Module { |
