Skip to content

Commit

Permalink
Sort unstable items last in rustdoc, instead of first
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 24, 2023
1 parent a994f46 commit b77aa74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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
6 changes: 3 additions & 3 deletions tests/rustdoc/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#![unstable(feature = "test", issue = "none")]

// @has stability/index.html
// @has - '//ul[@class="item-table"]/li[1]//a' Unstable
// @has - '//ul[@class="item-table"]/li[2]//a' AaStable
// @has - '//ul[@class="item-table"]/li[3]//a' ZzStable
// @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;
Expand Down

0 comments on commit b77aa74

Please sign in to comment.