Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/librustdoc/passes/propagate_stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
28 changes: 28 additions & 0 deletions tests/rustdoc/inline_local/staged-inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
}
}
Loading