File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -674,6 +674,13 @@ impl<'tcx> ExistentialPredicate<'tcx> {
674674 /// made to the tree. In particular, this ordering is preserved across incremental compilations.
675675 pub fn stable_cmp ( & self , tcx : TyCtxt < ' tcx > , other : & Self ) -> Ordering {
676676 use self :: ExistentialPredicate :: * ;
677+ // Note that we only call this method after checking that the
678+ // given predicates represent a valid trait object.
679+ //
680+ // This means that we have at most one `ExistentialPredicate::Trait`
681+ // and at most one `ExistentialPredicate::Projection` for each associated item.
682+ // We therefore do not have to worry about the ordering for cases which
683+ // are not well formed.
677684 match ( * self , * other) {
678685 ( Trait ( _) , Trait ( _) ) => Ordering :: Equal ,
679686 ( Projection ( ref a) , Projection ( ref b) ) => {
You can’t perform that action at this time.
0 commit comments