Skip to content

Commit 74aca3f

Browse files
committed
rustdoc: use import stability marker in display
1 parent 336209e commit 74aca3f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/librustdoc/passes/propagate_stability.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ impl DocFolder for StabilityPropagator<'_, '_> {
3636

3737
let stability = match item.item_id {
3838
ItemId::DefId(def_id) => {
39-
let own_stability = self.cx.tcx.lookup_stability(def_id);
39+
let own_stability = item
40+
.inline_stmt_id
41+
.and_then(|did| self.cx.tcx.lookup_stability(did))
42+
.or_else(|| self.cx.tcx.lookup_stability(def_id));
4043

4144
let (ItemKind::StrippedItem(box kind) | kind) = &item.kind;
4245
match kind {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// https://github.com/rust-lang/rust/issues/135078
2+
#![crate_name = "foo"]
3+
#![feature(staged_api)]
4+
#![stable(feature = "v1", since="1.0.0")]
5+
6+
#[stable(feature = "v1", since="1.0.0")]
7+
pub mod ffi {
8+
#[stable(feature = "core_ffi", since="1.99.0")]
9+
//@ has "foo/ffi/struct.CStr.html" "//span[@class='sub-heading']/span[@class='since']" "1.99.0"
10+
//@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.0.0"
11+
pub struct CStr;
12+
}
13+
14+
#[stable(feature = "v1", since = "1.0.0")]
15+
#[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"
18+
pub use ffi::CStr;

0 commit comments

Comments
 (0)