Commit 377d5ba
authored
Rollup merge of #157039 - lcian:fix/glob-reexport-feature-combination, r=GuillaumeGomez
rustdoc: correctly propagate cfgs for glob reexports
This fixes some cases of rustdoc not surfacing the correct required feature combination when using `#[cfg(feature = ...)]` in combination with glob reexports.
See the example cases included as tests.
Here's the generated HTML for those test cases before this change:
<img width="150" height="115" alt="Screenshot_20260528_201140" src="https://github.com/user-attachments/assets/8d611f88-7149-49f6-8ee0-530c049ea858" />
and after:
<img width="225" height="125" alt="Screenshot_20260528_201236" src="https://github.com/user-attachments/assets/85cc07c0-9a9a-455f-8ada-69d44d645516" />
My understanding is that this was basically an off-by-one type of oversight.
We need to update `is_inline` before calling `get_all_import_attributes` to immediately reflect that the outermost import we're processing shall indeed be considered as inline, as it's a glob.
Otherwise, we will end up calling `add_without_unwanted_attributes` with `is_inline == false` on the "intermediate" re-export, which will skip propagating its `cfg`s.
I believe this fixes #96166, even though the description there is not super clear on the exact test case they used (there's a snippet but the author says their code is actually different).
Refs #43781
@rustbot label +F-doc_cfg
@rustbot r? @GuillaumeGomez2 files changed
Lines changed: 68 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
247 | 246 | | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| |||
Lines changed: 67 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
0 commit comments