Skip to content

Commit 006f8dd

Browse files
Revert "Get rid of subst-relate incompleteness in new solver"
This reverts commit e320112.
1 parent a5f89d8 commit 006f8dd

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

compiler/rustc_trait_selection/src/solve/alias_relate.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,24 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
7979
Invert::Yes,
8080
));
8181
// Relate via args
82-
candidates.extend(
83-
self.assemble_subst_relate_candidate(
84-
param_env, alias_lhs, alias_rhs, direction,
85-
),
86-
);
82+
let subst_relate_response = self
83+
.assemble_subst_relate_candidate(param_env, alias_lhs, alias_rhs, direction);
84+
candidates.extend(subst_relate_response);
8785
debug!(?candidates);
8886

8987
if let Some(merged) = self.try_merge_responses(&candidates) {
9088
Ok(merged)
9189
} else {
92-
// When relating two aliases and we have ambiguity, if both
93-
// aliases can be normalized to something, we prefer
94-
// "bidirectionally normalizing" both of them within the same
95-
// candidate.
96-
//
97-
// See <https://github.com/rust-lang/trait-system-refactor-initiative/issues/25>.
90+
// When relating two aliases and we have ambiguity, we prefer
91+
// relating the generic arguments of the aliases over normalizing
92+
// them. This is necessary for inference during typeck.
9893
//
9994
// As this is incomplete, we must not do so during coherence.
10095
match self.solver_mode() {
10196
SolverMode::Normal => {
102-
if let Ok(bidirectional_normalizes_to_response) = self
97+
if let Ok(subst_relate_response) = subst_relate_response {
98+
Ok(subst_relate_response)
99+
} else if let Ok(bidirectional_normalizes_to_response) = self
103100
.assemble_bidirectional_normalizes_to_candidate(
104101
param_env, lhs, rhs, direction,
105102
)

0 commit comments

Comments
 (0)