@@ -22,7 +22,7 @@ use rustc_ast::ast;
2222use rustc_ast:: ast:: MetaItemKind ;
2323use rustc_attr:: { list_contains_name, InlineAttr , OptimizeAttr } ;
2424use rustc_data_structures:: captures:: Captures ;
25- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
25+ use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexSet } ;
2626use rustc_errors:: { struct_span_err, Applicability } ;
2727use rustc_hir as hir;
2828use rustc_hir:: def:: { CtorKind , DefKind , Res } ;
@@ -1718,21 +1718,17 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
17181718 /// A data structure with unique elements, which preserves order of insertion.
17191719 /// Preserving the order of insertion is important here so as not to break
17201720 /// compile-fail UI tests.
1721- // FIXME(eddyb) just use `IndexSet` from `indexmap`.
17221721 struct UniquePredicates < ' tcx > {
1723- predicates : Vec < ( ty:: Predicate < ' tcx > , Span ) > ,
1724- uniques : FxHashSet < ( ty:: Predicate < ' tcx > , Span ) > ,
1722+ predicates : FxIndexSet < ( ty:: Predicate < ' tcx > , Span ) > ,
17251723 }
17261724
17271725 impl < ' tcx > UniquePredicates < ' tcx > {
17281726 fn new ( ) -> Self {
1729- UniquePredicates { predicates : vec ! [ ] , uniques : FxHashSet :: default ( ) }
1727+ UniquePredicates { predicates : FxIndexSet :: default ( ) }
17301728 }
17311729
17321730 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) ;
17361732 }
17371733
17381734 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
20142010 } ) )
20152011 }
20162012
2017- let mut predicates = predicates. predicates ;
2013+ let mut predicates: Vec < _ > = predicates. predicates . into_iter ( ) . collect ( ) ;
20182014
20192015 // Subtle: before we store the predicates into the tcx, we
20202016 // sort them so that predicates like `T: Foo<Item=U>` come
0 commit comments