Skip to content

Commit 5c6fc68

Browse files
authored
Unrolled build for #147153
Rollup merge of #147153 - GuillaumeGomez:doc-propagation-before-stripping-items, r=lolbinarycat [rustdoc] Move doc cfg propagation pass before items stripping passes Follow-up of #138907. r? lolbinarycat
2 parents 29b7717 + 9119eba commit 5c6fc68

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/librustdoc/passes/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ pub(crate) enum Condition {
7777
pub(crate) const PASSES: &[Pass] = &[
7878
CHECK_DOC_CFG,
7979
CHECK_DOC_TEST_VISIBILITY,
80+
PROPAGATE_DOC_CFG,
8081
STRIP_ALIASED_NON_LOCAL,
8182
STRIP_HIDDEN,
8283
STRIP_PRIVATE,
8384
STRIP_PRIV_IMPORTS,
84-
PROPAGATE_DOC_CFG,
8585
PROPAGATE_STABILITY,
8686
COLLECT_INTRA_DOC_LINKS,
8787
COLLECT_TRAIT_IMPLS,
@@ -94,11 +94,11 @@ pub(crate) const DEFAULT_PASSES: &[ConditionalPass] = &[
9494
ConditionalPass::always(COLLECT_TRAIT_IMPLS),
9595
ConditionalPass::always(CHECK_DOC_TEST_VISIBILITY),
9696
ConditionalPass::always(CHECK_DOC_CFG),
97+
ConditionalPass::always(COLLECT_INTRA_DOC_LINKS),
9798
ConditionalPass::always(STRIP_ALIASED_NON_LOCAL),
9899
ConditionalPass::new(STRIP_HIDDEN, WhenNotDocumentHidden),
99100
ConditionalPass::new(STRIP_PRIVATE, WhenNotDocumentPrivate),
100101
ConditionalPass::new(STRIP_PRIV_IMPORTS, WhenDocumentPrivate),
101-
ConditionalPass::always(COLLECT_INTRA_DOC_LINKS),
102102
ConditionalPass::always(PROPAGATE_DOC_CFG),
103103
ConditionalPass::always(PROPAGATE_STABILITY),
104104
ConditionalPass::always(RUN_LINTS),

tests/rustdoc-ui/issues/issue-91713.stdout

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Available passes for running rustdoc:
22
check-doc-cfg - checks `#[doc(cfg(...))]` for stability feature and unexpected cfgs
33
check_doc_test_visibility - run various visibility-related lints on doctests
4+
propagate-doc-cfg - propagates `#[doc(cfg(...))]` to child items
45
strip-aliased-non-local - strips all non-local private aliased items from the output
56
strip-hidden - strips all `#[doc(hidden)]` items from the output
67
strip-private - strips all private items from a crate which cannot be seen externally, implies strip-priv-imports
78
strip-priv-imports - strips all private import statements (`use`, `extern crate`) from a crate
8-
propagate-doc-cfg - propagates `#[doc(cfg(...))]` to child items
99
propagate-stability - propagates stability to child items
1010
collect-intra-doc-links - resolves intra-doc links
1111
collect-trait-impls - retrieves trait impls for items in the crate
@@ -16,11 +16,11 @@ Default passes for rustdoc:
1616
collect-trait-impls
1717
check_doc_test_visibility
1818
check-doc-cfg
19+
collect-intra-doc-links
1920
strip-aliased-non-local
2021
strip-hidden (when not --document-hidden-items)
2122
strip-private (when not --document-private-items)
2223
strip-priv-imports (when --document-private-items)
23-
collect-intra-doc-links
2424
propagate-doc-cfg
2525
propagate-stability
2626
run-lints
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This test ensures that even though private items are removed from generated docs,
2+
// their `cfg`s will still impact their child items.
3+
4+
#![feature(doc_cfg)]
5+
#![crate_name = "foo"]
6+
7+
pub struct X;
8+
9+
#[cfg(not(feature = "blob"))]
10+
fn foo() {
11+
impl X {
12+
//@ has 'foo/struct.X.html'
13+
//@ has - '//*[@class="stab portability"]' 'Available on non-crate feature blob only.'
14+
pub fn bar() {}
15+
}
16+
}

0 commit comments

Comments
 (0)