diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-02-26 04:15:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-26 04:15:03 +0100 |
| commit | ef539221f629304035d2dab7cedaa2b4de3c107f (patch) | |
| tree | fd2896f54e2a5bb4bcb9c9ff8d1e13ab47c7c5c0 | |
| parent | 49249eae1155e1bbc0159902341e7734fd4378b1 (diff) | |
| parent | afc89a1e021c99bdcd89a71c4c93ff6f3a2072c8 (diff) | |
| download | rust-ef539221f629304035d2dab7cedaa2b4de3c107f.tar.gz rust-ef539221f629304035d2dab7cedaa2b4de3c107f.zip | |
Rollup merge of #137320 - tapanprakasht:fix-doc-version-stability, r=notriddle
fix(rustdoc): Fixed stability version in rustdoc Tries to fix https://github.com/rust-lang/rust/issues/137141 Fixed by adding checks glob exports
| -rw-r--r-- | src/librustdoc/passes/propagate_stability.rs | 12 | ||||
| -rw-r--r-- | tests/rustdoc/inline_local/staged-inline.rs | 28 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/librustdoc/passes/propagate_stability.rs b/src/librustdoc/passes/propagate_stability.rs index 9c958710c42..8cf39afd55c 100644 --- a/src/librustdoc/passes/propagate_stability.rs +++ b/src/librustdoc/passes/propagate_stability.rs @@ -39,6 +39,16 @@ impl DocFolder for StabilityPropagator<'_, '_> { let item_stability = self.cx.tcx.lookup_stability(def_id); let inline_stability = item.inline_stmt_id.and_then(|did| self.cx.tcx.lookup_stability(did)); + let is_glob_export = item.inline_stmt_id.and_then(|id| { + let hir_id = self.cx.tcx.local_def_id_to_hir_id(id); + Some(matches!( + self.cx.tcx.hir_node(hir_id), + rustc_hir::Node::Item(rustc_hir::Item { + kind: rustc_hir::ItemKind::Use(_, rustc_hir::UseKind::Glob), + .. + }) + )) + }); let own_stability = if let Some(item_stab) = item_stability && let StabilityLevel::Stable { since: _, allowed_through_unstable_modules } = item_stab.level @@ -47,6 +57,8 @@ impl DocFolder for StabilityPropagator<'_, '_> { since: inline_since, allowed_through_unstable_modules: _, } = inline_stab.level + && let Some(is_global_export) = is_glob_export + && !is_global_export { inline_stab.level = StabilityLevel::Stable { since: inline_since, diff --git a/tests/rustdoc/inline_local/staged-inline.rs b/tests/rustdoc/inline_local/staged-inline.rs index f2131ad5f94..d0dc3f9eea7 100644 --- a/tests/rustdoc/inline_local/staged-inline.rs +++ b/tests/rustdoc/inline_local/staged-inline.rs @@ -16,3 +16,31 @@ pub mod ffi { //@ has "foo/struct.CStr.html" "//span[@class='sub-heading']/span[@class='since']" "1.0.0" //@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.99.0" pub use ffi::CStr; + +// https://github.com/rust-lang/rust/issues/137141 +#[stable(feature = "futures_api", since = "1.36.0")] +//@ has "foo/task/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0" +//@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.0.0" +pub mod task { + + #[doc(inline)] + #[stable(feature = "futures_api", since = "1.36.0")] + //@ has "foo/task/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0" + //@ has "foo/task/ready/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.64.0" + pub use core::task::*; +} + +#[stable(feature = "futures_api", since = "1.36.0")] +//@ has "foo/core/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0" +//@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.0.0" +pub mod core { + #[stable(feature = "futures_api", since = "1.36.0")] + //@ has "foo/core/task/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0" + pub mod task { + + #[stable(feature = "ready_macro", since = "1.64.0")] + //@ has "foo/core/task/ready/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.64.0" + pub mod ready { + } + } +} |
