@@ -30,7 +30,7 @@ use util::common::ErrorReported;
30
30
use util::nodemap::{FxHashSet, FxHashMap};
31
31
use errors::FatalError;
32
32
33
- use std::cmp::Ordering;
33
+ // use std::cmp::Ordering;
34
34
use std::iter;
35
35
use syntax::ast;
36
36
use syntax::feature_gate::{GateIssue, emit_feature_err};
@@ -646,7 +646,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
646
646
&mut vec![]);
647
647
}
648
648
649
- let (auto_traits, trait_bounds) = split_auto_traits(tcx, &trait_bounds[1..]);
649
+ let (mut auto_traits, trait_bounds) = split_auto_traits(tcx, &trait_bounds[1..]);
650
650
651
651
if !trait_bounds.is_empty() {
652
652
let b = &trait_bounds[0];
@@ -708,15 +708,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
708
708
}
709
709
710
710
// Dedup auto traits so that `dyn Trait + Send + Send` is the same as `dyn Trait + Send`.
711
- let mut auto_traits =
712
- auto_traits.into_iter().map(ty::ExistentialPredicate::AutoTrait).collect::<Vec<_>>();
713
- auto_traits.sort_by(|a, b| a.cmp(tcx, b));
714
- auto_traits.dedup_by(|a, b| (&*a).cmp(tcx, b) == Ordering::Equal);
711
+ auto_traits.sort();
712
+ auto_traits.dedup();
715
713
716
714
// skip_binder is okay, because the predicates are re-bound.
717
715
let mut v =
718
716
iter::once(ty::ExistentialPredicate::Trait(*existential_principal.skip_binder()))
719
- .chain(auto_traits.into_iter())
717
+ .chain(auto_traits.into_iter().map(ty::ExistentialPredicate::AutoTrait) )
720
718
.chain(existential_projections
721
719
.map(|x| ty::ExistentialPredicate::Projection(*x.skip_binder())))
722
720
.collect::<AccumulateVec<[_; 8]>>();
0 commit comments