@@ -66,24 +66,27 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
6666 Invert :: Yes ,
6767 ) ) ;
6868 // Relate via args
69- let subst_relate_response = self
70- . assemble_subst_relate_candidate ( param_env, alias_lhs, alias_rhs, direction) ;
71- candidates. extend ( subst_relate_response) ;
69+ candidates. extend (
70+ self . assemble_subst_relate_candidate (
71+ param_env, alias_lhs, alias_rhs, direction,
72+ ) ,
73+ ) ;
7274 debug ! ( ?candidates) ;
7375
7476 if let Some ( merged) = self . try_merge_responses ( & candidates) {
7577 Ok ( merged)
7678 } else {
77- // When relating two aliases and we have ambiguity, we prefer
78- // relating the generic arguments of the aliases over normalizing
79- // them. This is necessary for inference during typeck.
79+ // When relating two aliases and we have ambiguity, if both
80+ // aliases can be normalized to something, we prefer
81+ // "bidirectionally normalizing" both of them within the same
82+ // candidate.
83+ //
84+ // See <https://github.com/rust-lang/trait-system-refactor-initiative/issues/25>.
8085 //
8186 // As this is incomplete, we must not do so during coherence.
8287 match self . solver_mode ( ) {
8388 SolverMode :: Normal => {
84- if let Ok ( subst_relate_response) = subst_relate_response {
85- Ok ( subst_relate_response)
86- } else if let Ok ( bidirectional_normalizes_to_response) = self
89+ if let Ok ( bidirectional_normalizes_to_response) = self
8790 . assemble_bidirectional_normalizes_to_candidate (
8891 param_env, lhs, rhs, direction,
8992 )
0 commit comments