about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustdoc/passes/propagate_stability.rs12
-rw-r--r--tests/rustdoc/inline_local/staged-inline.rs28
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 {
+        }
+    }
+}