@@ -66,24 +66,27 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
66
66
Invert :: Yes ,
67
67
) ) ;
68
68
// 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
+ ) ;
72
74
debug ! ( ?candidates) ;
73
75
74
76
if let Some ( merged) = self . try_merge_responses ( & candidates) {
75
77
Ok ( merged)
76
78
} 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>.
80
85
//
81
86
// As this is incomplete, we must not do so during coherence.
82
87
match self . solver_mode ( ) {
83
88
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
87
90
. assemble_bidirectional_normalizes_to_candidate (
88
91
param_env, lhs, rhs, direction,
89
92
)
0 commit comments