Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort unstable items last in rustdoc, instead of first #118224

Merged
merged 2 commits into from
Nov 24, 2023
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
4 changes: 2 additions & 2 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
if let (Some(a), Some(b)) = (s1, s2) {
match (a.is_stable(), b.is_stable()) {
(true, true) | (false, false) => {}
(false, true) => return Ordering::Less,
(true, false) => return Ordering::Greater,
(false, true) => return Ordering::Greater,
(true, false) => return Ordering::Less,
}
}
let lhs = i1.name.unwrap_or(kw::Empty);
Expand Down
11 changes: 11 additions & 0 deletions tests/rustdoc/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

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

// @has stability/index.html
// @has - '//ul[@class="item-table"]/li[1]//a' AaStable
// @has - '//ul[@class="item-table"]/li[2]//a' ZzStable
// @has - '//ul[@class="item-table"]/li[3]//a' Unstable

#[stable(feature = "rust2", since = "2.2.2")]
pub struct AaStable;

pub struct Unstable {
// @has stability/struct.Unstable.html \
// '//span[@class="item-info"]//div[@class="stab unstable"]' \
Expand All @@ -10,3 +18,6 @@ pub struct Unstable {
pub foo: u32,
pub bar: u32,
}

#[stable(feature = "rust2", since = "2.2.2")]
pub struct ZzStable;
Loading