Skip to content

Commit 2440ec4

Browse files
committed
fix(rustdoc): Fixed stability version in rustdoc
1 parent 28b83ee commit 2440ec4

File tree

3 files changed

+33
-23
lines changed

3 files changed

+33
-23
lines changed

src/librustdoc/passes/propagate_stability.rs

+1-21
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,7 @@ impl DocFolder for StabilityPropagator<'_, '_> {
3636

3737
let stability = match item.item_id {
3838
ItemId::DefId(def_id) => {
39-
let item_stability = self.cx.tcx.lookup_stability(def_id);
40-
let inline_stability =
41-
item.inline_stmt_id.and_then(|did| self.cx.tcx.lookup_stability(did));
42-
let own_stability = if let Some(item_stab) = item_stability
43-
&& let StabilityLevel::Stable { since: _, allowed_through_unstable_modules } =
44-
item_stab.level
45-
&& let Some(mut inline_stab) = inline_stability
46-
&& let StabilityLevel::Stable {
47-
since: inline_since,
48-
allowed_through_unstable_modules: _,
49-
} = inline_stab.level
50-
{
51-
inline_stab.level = StabilityLevel::Stable {
52-
since: inline_since,
53-
allowed_through_unstable_modules,
54-
};
55-
Some(inline_stab)
56-
} else {
57-
item_stability
58-
};
59-
39+
let own_stability = self.cx.tcx.lookup_stability(def_id);
6040
let (ItemKind::StrippedItem(box kind) | kind) = &item.kind;
6141
match kind {
6242
ItemKind::ExternCrateItem { .. }

tests/rustdoc/inline_local/staged-inline.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ pub mod ffi {
1313

1414
#[stable(feature = "v1", since = "1.0.0")]
1515
#[doc(inline)]
16-
//@ has "foo/struct.CStr.html" "//span[@class='sub-heading']/span[@class='since']" "1.0.0"
17-
//@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.99.0"
16+
//@ has "foo/struct.CStr.html" "//span[@class='sub-heading']/span[@class='since']" "1.99.0"
17+
//@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.0.0"
1818
pub use ffi::CStr;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#![crate_name = "foo"]
2+
#![feature(staged_api)]
3+
#![stable(feature = "v1", since="1.0.0")]
4+
5+
#[stable(feature = "futures_api", since = "1.36.0")]
6+
//@ has "foo/task/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0"
7+
//@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.0.0"
8+
pub mod task {
9+
10+
#[doc(inline)]
11+
#[stable(feature = "futures_api", since = "1.36.0")]
12+
//@ has "foo/task/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0"
13+
//@ has "foo/task/ready/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.64.0"
14+
pub use core::task::*;
15+
}
16+
17+
#[stable(feature = "futures_api", since = "1.36.0")]
18+
//@ has "foo/core/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0"
19+
//@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.0.0"
20+
pub mod core {
21+
#[stable(feature = "futures_api", since = "1.36.0")]
22+
//@ has "foo/core/task/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.36.0"
23+
pub mod task {
24+
25+
#[stable(feature = "ready_macro", since = "1.64.0")]
26+
//@ has "foo/core/task/ready/index.html" "//span[@class='sub-heading']/span[@class='since']" "1.64.0"
27+
pub mod ready {
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)