diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-01-07 21:39:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-07 21:39:41 +0100 |
| commit | 0e48e96e656b056dbb55cf241472ee130ff21ff4 (patch) | |
| tree | c974592c9386acc8ab155789c30443d1999aaa4a /src | |
| parent | 3e12d4d152e7fff87af413853a628c0571ad44e8 (diff) | |
| parent | c7a806ad081947c77b415c0097cbbd3925ac759b (diff) | |
Rollup merge of #135171 - notriddle:notriddle/stable-path-is-better, r=GuillaumeGomez
rustdoc: use stable paths as preferred canonical paths This accomplishes something like 16a4ad7d7b0d163f7be6803c786c3b83d42913bb, but with the `rustc_allowed_through_unstable_modules` attribute instead of the path length. Fixes #131676
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/formats/cache.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index e64baca974d..7a95d33723e 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -1,5 +1,6 @@ use std::mem; +use rustc_attr_parsing::StabilityLevel; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet}; use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet}; use rustc_middle::ty::{self, TyCtxt}; @@ -306,7 +307,12 @@ impl DocFolder for CacheBuilder<'_, '_> { | clean::ProcMacroItem(..) | clean::VariantItem(..) => { use rustc_data_structures::fx::IndexEntry as Entry; - if !self.cache.stripped_mod { + if !self.cache.stripped_mod + && !matches!( + item.stability.map(|stab| stab.level), + Some(StabilityLevel::Stable { allowed_through_unstable_modules: true, .. }) + ) + { // Re-exported items mean that the same id can show up twice // in the rustdoc ast that we're looking at. We know, // however, that a re-exported item doesn't show up in the |
