Skip to content

Commit 0aae1ec

Browse files
authored
Rollup merge of #92937 - GuillaumeGomez:dot-separator, r=jsha
rustdoc: Add missing dot separator Fixes #92901. ![Screenshot from 2022-01-15 17-47-18](https://user-images.githubusercontent.com/3050060/149631249-e2c0c3a4-9ed8-48e2-92cc-79a5bb347b35.png) r? ``@jsha``
2 parents 216ce7c + 75967ce commit 0aae1ec

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

src/librustdoc/html/render/print_item.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,11 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
670670
}
671671
write!(w, "<div id=\"{}\" class=\"method has-srclink\">", id);
672672
write!(w, "<div class=\"rightside\">");
673-
render_stability_since(w, m, t, cx.tcx());
673+
674+
let has_stability = render_stability_since(w, m, t, cx.tcx());
675+
if has_stability {
676+
w.write_str(" · ");
677+
}
674678
write_srclink(cx, m, w);
675679
write!(w, "</div>");
676680
write!(w, "<h4 class=\"code-header\">");
@@ -1457,14 +1461,14 @@ fn render_stability_since(
14571461
item: &clean::Item,
14581462
containing_item: &clean::Item,
14591463
tcx: TyCtxt<'_>,
1460-
) {
1464+
) -> bool {
14611465
render_stability_since_raw(
14621466
w,
14631467
item.stable_since(tcx),
14641468
item.const_stability(tcx),
14651469
containing_item.stable_since(tcx),
14661470
containing_item.const_stable_since(tcx),
1467-
);
1471+
)
14681472
}
14691473

14701474
fn compare_impl<'a, 'b>(lhs: &'a &&Impl, rhs: &'b &&Impl, cx: &Context<'_>) -> Ordering {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#![stable(feature = "bar", since = "1.0")]
2+
#![crate_name = "foo"]
3+
4+
#![feature(staged_api)]
5+
6+
// @has foo/trait.Bar.html
7+
// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0· source · '
8+
#[stable(feature = "bar", since = "1.0")]
9+
pub trait Bar {
10+
// @has - '//div[@id="tymethod.foo"]/*[@class="rightside"]' '3.0 · source'
11+
#[stable(feature = "foobar", since = "3.0")]
12+
fn foo();
13+
}
14+
15+
// @has - '//div[@id="implementors-list"]//*[@class="rightside"]' '4.0 · source'
16+
17+
// @has foo/struct.Foo.html
18+
// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0· source · '
19+
#[stable(feature = "baz", since = "1.0")]
20+
pub struct Foo;
21+
22+
impl Foo {
23+
// @has - '//div[@id="method.foofoo"]/*[@class="rightside"]' '3.0 · source'
24+
#[stable(feature = "foobar", since = "3.0")]
25+
pub fn foofoo() {}
26+
}
27+
28+
#[stable(feature = "yolo", since = "4.0")]
29+
impl Bar for Foo {
30+
fn foo() {}
31+
}

0 commit comments

Comments
 (0)