Skip to content

Commit b226d17

Browse files
Fix generics where bounds order
1 parent e0c38af commit b226d17

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/librustdoc/clean/simplify.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
//! This module attempts to reconstruct the original where and/or parameter
1212
//! bounds by special casing scenarios such as these. Fun!
1313
14-
use std::collections::BTreeMap;
15-
14+
use rustc_data_structures::fx::FxIndexMap;
1615
use rustc_hir::def_id::DefId;
1716
use rustc_middle::ty;
1817
use rustc_span::Symbol;
@@ -23,8 +22,11 @@ use crate::clean::WherePredicate as WP;
2322
use crate::core::DocContext;
2423

2524
crate fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
26-
// First, partition the where clause into its separate components
27-
let mut params: BTreeMap<_, (Vec<_>, Vec<_>)> = BTreeMap::new();
25+
// First, partition the where clause into its separate components.
26+
//
27+
// We use `FxIndexMap` so that the insertion order is preserved to prevent messing up to
28+
// the order of the generated bounds.
29+
let mut params: FxIndexMap<Symbol, (Vec<_>, Vec<_>)> = FxIndexMap::default();
2830
let mut lifetimes = Vec::new();
2931
let mut equalities = Vec::new();
3032
let mut tybounds = Vec::new();

0 commit comments

Comments
 (0)