Skip to content

rustdoc: preserve doc(cfg) on locally re-exported type aliases#154970

Open
shivendra02467 wants to merge 1 commit intorust-lang:mainfrom
shivendra02467:fix-rustdoc-154921
Open

rustdoc: preserve doc(cfg) on locally re-exported type aliases#154970
shivendra02467 wants to merge 1 commit intorust-lang:mainfrom
shivendra02467:fix-rustdoc-154921

Conversation

@shivendra02467
Copy link
Copy Markdown
Contributor

@shivendra02467 shivendra02467 commented Apr 7, 2026

When a type alias is locally re-exported from a private module (an implicit inline), rustdoc drops its cfg attributes because it treats it like a standard un-inlined re-export. Since type aliases have no inner fields to carry the cfg badge (unlike structs or enums), the portability info is lost entirely.

This patch explicitly preserves the target's cfg metadata when the generated item is a TypeAliasItem, ensuring the portability badge renders correctly without breaking standard cross-crate re-export behavior.

Fixes #154921

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Apr 7, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 7, 2026

r? @notriddle

rustbot has assigned @notriddle.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: rustdoc
  • rustdoc expanded to 9 candidates
  • Random selection from GuillaumeGomez, camelid, fmease, lolbinarycat, notriddle

@GuillaumeGomez
Copy link
Copy Markdown
Member

Thanks!

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 15, 2026

📌 Commit 617d9de has been approved by GuillaumeGomez

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 15, 2026
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 15, 2026
… r=GuillaumeGomez

rustdoc: preserve `doc(cfg)` on locally re-exported type aliases

When a type alias is locally re-exported from a private module (an implicit inline), rustdoc drops its `cfg` attributes because it treats it like a standard un-inlined re-export. Since type aliases have no inner fields to carry the `cfg` badge (unlike structs or enums), the portability info is lost entirely.

This patch explicitly preserves the target's `cfg` metadata when the generated item is a `TypeAliasItem`, ensuring the portability badge renders correctly without breaking standard cross-crate re-export behavior.

Fixes rust-lang#154921
rust-bors bot pushed a commit that referenced this pull request Apr 15, 2026
Rollup of 6 pull requests

Successful merges:

 - #147811 (naked functions: respect `function-sections`)
 - #154599 (report the `varargs_without_pattern` lint in deps)
 - #154970 (rustdoc: preserve `doc(cfg)` on locally re-exported type aliases)
 - #155326 (Disallow ZST allocations with `TypedArena`.)
 - #155340 (Handle nonnull pattern types in size skeleton)
 - #155347 (Add push_mut and new Layout methods to release notes)
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 16, 2026
… r=GuillaumeGomez

rustdoc: preserve `doc(cfg)` on locally re-exported type aliases

When a type alias is locally re-exported from a private module (an implicit inline), rustdoc drops its `cfg` attributes because it treats it like a standard un-inlined re-export. Since type aliases have no inner fields to carry the `cfg` badge (unlike structs or enums), the portability info is lost entirely.

This patch explicitly preserves the target's `cfg` metadata when the generated item is a `TypeAliasItem`, ensuring the portability badge renders correctly without breaking standard cross-crate re-export behavior.

Fixes rust-lang#154921
rust-bors bot pushed a commit that referenced this pull request Apr 16, 2026
Rollup of 18 pull requests

Successful merges:

 - #154595 (Emit fatal on invalid const args with nested defs)
 - #154599 (report the `varargs_without_pattern` lint in deps)
 - #154699 (`core::unicode`: Replace `Cased` table with `Lt`)
 - #155353 (resolve: Remove `inaccessible_ctor_reexport` resolver field)
 - #155357 (Add `--remap-path-scope` as unstable in rustdoc)
 - #150649 (clippy fix: non_canonical_clone_impl)
 - #154604 (abort in core)
 - #154616 (Add `--quiet` flag to x.py and bootstrap to suppress output)
 - #154970 (rustdoc: preserve `doc(cfg)` on locally re-exported type aliases)
 - #155215 (Clean up `AttributeLintKind` and refactor diagnostic attribute linting)
 - #155228 (Check diagnostic output in incremental `cpass` and `rpass` revisions)
 - #155266 (Adjust release notes for post-merge feedback)
 - #155326 (Disallow ZST allocations with `TypedArena`.)
 - #155334 (docs: Use `0b1` instead of `NonZero::MIN` in `NonZero::bit_width` doctests)
 - #155340 (Handle nonnull pattern types in size skeleton)
 - #155347 (Add push_mut and new Layout methods to release notes)
 - #155356 (remove calls to AliasTyKind::def_id)
 - #155364 (Reduce diagnostic type visibilities.)
@jhpratt
Copy link
Copy Markdown
Member

jhpratt commented Apr 16, 2026

@bors r-

#155373 (comment)

@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 16, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 16, 2026

This pull request was unapproved.

This PR was contained in a rollup (#155373), which was unapproved.

When a type alias is locally re-exported from a private module (an implicit
inline), rustdoc drops its `cfg` attributes because it treats it like a
standard un-inlined re-export. Since type aliases have no inner fields to
carry the `cfg` badge (unlike structs or enums), the portability info
is lost entirely.

This patch explicitly preserves the target's `cfg` metadata when the
generated item is a `TypeAliasItem`, ensuring the portability badge
renders correctly without breaking standard cross-crate re-export behavior.
@shivendra02467
Copy link
Copy Markdown
Contributor Author

Fixed a cross-platform test failure on macOS by switching target_os to a custom feature flag.
@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 16, 2026
@GuillaumeGomez
Copy link
Copy Markdown
Member

Didn't think about the cfg in the test, my bad. The updated code looks good so let's go again. Thanks!

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 16, 2026

📌 Commit 52ad8c0 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 16, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 16, 2026
… r=GuillaumeGomez

rustdoc: preserve `doc(cfg)` on locally re-exported type aliases

When a type alias is locally re-exported from a private module (an implicit inline), rustdoc drops its `cfg` attributes because it treats it like a standard un-inlined re-export. Since type aliases have no inner fields to carry the `cfg` badge (unlike structs or enums), the portability info is lost entirely.

This patch explicitly preserves the target's `cfg` metadata when the generated item is a `TypeAliasItem`, ensuring the portability badge renders correctly without breaking standard cross-crate re-export behavior.

Fixes rust-lang#154921
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 16, 2026
… r=GuillaumeGomez

rustdoc: preserve `doc(cfg)` on locally re-exported type aliases

When a type alias is locally re-exported from a private module (an implicit inline), rustdoc drops its `cfg` attributes because it treats it like a standard un-inlined re-export. Since type aliases have no inner fields to carry the `cfg` badge (unlike structs or enums), the portability info is lost entirely.

This patch explicitly preserves the target's `cfg` metadata when the generated item is a `TypeAliasItem`, ensuring the portability badge renders correctly without breaking standard cross-crate re-export behavior.

Fixes rust-lang#154921
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 16, 2026
… r=GuillaumeGomez

rustdoc: preserve `doc(cfg)` on locally re-exported type aliases

When a type alias is locally re-exported from a private module (an implicit inline), rustdoc drops its `cfg` attributes because it treats it like a standard un-inlined re-export. Since type aliases have no inner fields to carry the `cfg` badge (unlike structs or enums), the portability info is lost entirely.

This patch explicitly preserves the target's `cfg` metadata when the generated item is a `TypeAliasItem`, ensuring the portability badge renders correctly without breaking standard cross-crate re-export behavior.

Fixes rust-lang#154921
rust-bors bot pushed a commit that referenced this pull request Apr 17, 2026
Rollup of 13 pull requests

Successful merges:

 - #152980 (c-variadic: fix implementation on `avr`)
 - #154491 (Extend `core::char`'s documentation of casing issues (and fix a rustdoc bug))
 - #155354 (Remove AttributeSafety from BUILTIN_ATTRIBUTES)
 - #154970 (rustdoc: preserve `doc(cfg)` on locally re-exported type aliases)
 - #155095 (changed the information provided by (mut x) to mut x (Fix 155030))
 - #155358 (ImproperCTypes: Move erasing_region_normalisation into helper function)
 - #155377 (tests/debuginfo/basic-stepping.rs: Remove FIXME related to ZSTs)
 - #155383 (Rearrange `rustc_ast_pretty`)
 - #155384 (triagebot: notify on diagnostic attribute changes)
 - #155386 (Use `box_new` diagnostic item for Box::new suggestions)
 - #155391 (Small refactor of `QueryJob::latch` method)
 - #155395 (Tweak how the "copy path" rustdoc button works to allow some accessibility tool to work with rustdoc)
 - #155396 (`as_ref_unchecked` docs link fix)
Zalathar added a commit to Zalathar/rust that referenced this pull request Apr 17, 2026
… r=GuillaumeGomez

rustdoc: preserve `doc(cfg)` on locally re-exported type aliases

When a type alias is locally re-exported from a private module (an implicit inline), rustdoc drops its `cfg` attributes because it treats it like a standard un-inlined re-export. Since type aliases have no inner fields to carry the `cfg` badge (unlike structs or enums), the portability info is lost entirely.

This patch explicitly preserves the target's `cfg` metadata when the generated item is a `TypeAliasItem`, ensuring the portability badge renders correctly without breaking standard cross-crate re-export behavior.

Fixes rust-lang#154921
rust-bors bot pushed a commit that referenced this pull request Apr 17, 2026
Rollup of 19 pull requests

Successful merges:

 - #141633 (Suggest to bind `self.x` to `x` when field `x` may be in format string)
 - #152980 (c-variadic: fix implementation on `avr`)
 - #154491 (Extend `core::char`'s documentation of casing issues (and fix a rustdoc bug))
 - #155318 (Use mutable pointers for Unix path buffers)
 - #155335 (Bump bootstrap to 1.96 beta)
 - #155354 (Remove AttributeSafety from BUILTIN_ATTRIBUTES)
 - #154970 (rustdoc: preserve `doc(cfg)` on locally re-exported type aliases)
 - #155095 (changed the information provided by (mut x) to mut x (Fix 155030))
 - #155305 (Make `convert_while_ascii` unsafe)
 - #155358 (ImproperCTypes: Move erasing_region_normalisation into helper function)
 - #155377 (tests/debuginfo/basic-stepping.rs: Remove FIXME related to ZSTs)
 - #155383 (Rearrange `rustc_ast_pretty`)
 - #155384 (triagebot: notify on diagnostic attribute changes)
 - #155386 (Use `box_new` diagnostic item for Box::new suggestions)
 - #155391 (Small refactor of `QueryJob::latch` method)
 - #155395 (Tweak how the "copy path" rustdoc button works to allow some accessibility tool to work with rustdoc)
 - #155396 (`as_ref_unchecked` docs link fix)
 - #155411 (compiletest: Remove the `//@ should-ice` directive)
 - #155413 (fix: typo in `std::fs::hard_link` documentation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc(auto_cfg) and doc(cfg) don't add cfgs to re-exported type aliases

5 participants