Skip to content

Commit

Permalink
Rollup merge of rust-lang#57954 - euclio:rustdoc-stability, r=QuietMi…
Browse files Browse the repository at this point in the history
…sdreavus

rustdoc: remove blank unstable spans

Rustdoc generates blank unstable spans for unstable struct fields: ![screen shot 2019-01-28 at 1 05 04 pm](https://user-images.githubusercontent.com/1372438/51856295-5e8ed500-22fd-11e9-8074-025eddb4ef65.png)

This PR removes them:
![screen shot 2019-01-28 at 1 07 22 pm](https://user-images.githubusercontent.com/1372438/51856424-aada1500-22fd-11e9-86f0-34e2aa78b8b1.png)

r? @QuietMisdreavus
  • Loading branch information
GuillaumeGomez committed Feb 7, 2019
2 parents 4c62d7e + 30b1c35 commit bb9d66d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3484,10 +3484,6 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
ns_id = ns_id,
name = field.name.as_ref().unwrap(),
ty = ty)?;
if let Some(stability_class) = field.stability_class() {
write!(w, "<span class='stab {stab}'></span>",
stab = stability_class)?;
}
document(w, cx, field)?;
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/test/rustdoc/stability.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#![feature(staged_api)]

#![unstable(feature = "test", issue = "0")]

pub struct Unstable {
// @has stability/struct.Unstable.html \
// '//div[@class="stability"]//div[@class="stab unstable"]' \
// 'This is a nightly-only experimental API'
// @count stability/struct.Unstable.html '//span[@class="stab unstable"]' 0
pub foo: u32,
pub bar: u32,
}

0 comments on commit bb9d66d

Please sign in to comment.