@@ -22,7 +22,7 @@ use rustc_ast::ast;
22
22
use rustc_ast:: ast:: MetaItemKind ;
23
23
use rustc_attr:: { list_contains_name, InlineAttr , OptimizeAttr } ;
24
24
use rustc_data_structures:: captures:: Captures ;
25
- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
25
+ use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexSet } ;
26
26
use rustc_errors:: { struct_span_err, Applicability } ;
27
27
use rustc_hir as hir;
28
28
use rustc_hir:: def:: { CtorKind , DefKind , Res } ;
@@ -1718,21 +1718,17 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
1718
1718
/// A data structure with unique elements, which preserves order of insertion.
1719
1719
/// Preserving the order of insertion is important here so as not to break
1720
1720
/// compile-fail UI tests.
1721
- // FIXME(eddyb) just use `IndexSet` from `indexmap`.
1722
1721
struct UniquePredicates < ' tcx > {
1723
- predicates : Vec < ( ty:: Predicate < ' tcx > , Span ) > ,
1724
- uniques : FxHashSet < ( ty:: Predicate < ' tcx > , Span ) > ,
1722
+ predicates : FxIndexSet < ( ty:: Predicate < ' tcx > , Span ) > ,
1725
1723
}
1726
1724
1727
1725
impl < ' tcx > UniquePredicates < ' tcx > {
1728
1726
fn new ( ) -> Self {
1729
- UniquePredicates { predicates : vec ! [ ] , uniques : FxHashSet :: default ( ) }
1727
+ UniquePredicates { predicates : FxIndexSet :: default ( ) }
1730
1728
}
1731
1729
1732
1730
fn push ( & mut self , value : ( ty:: Predicate < ' tcx > , Span ) ) {
1733
- if self . uniques . insert ( value) {
1734
- self . predicates . push ( value) ;
1735
- }
1731
+ self . predicates . insert ( value) ;
1736
1732
}
1737
1733
1738
1734
fn extend < I : IntoIterator < Item = ( ty:: Predicate < ' tcx > , Span ) > > ( & mut self , iter : I ) {
@@ -2014,7 +2010,7 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
2014
2010
} ) )
2015
2011
}
2016
2012
2017
- let mut predicates = predicates. predicates ;
2013
+ let mut predicates: Vec < _ > = predicates. predicates . into_iter ( ) . collect ( ) ;
2018
2014
2019
2015
// Subtle: before we store the predicates into the tcx, we
2020
2016
// sort them so that predicates like `T: Foo<Item=U>` come
0 commit comments