Skip to content

Commit d69da2f

Browse files
committed
Add back Normalize floundering
1 parent 2d193f3 commit d69da2f

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

chalk-solve/src/clauses.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ fn program_clauses_that_could_match<I: Interner>(
278278
match_ty(builder, environment, ty)?
279279
}
280280
DomainGoal::FromEnv(_) => (), // Computed in the environment
281-
DomainGoal::Normalize(Normalize { alias, ty: _ }) => {
281+
DomainGoal::Normalize(Normalize { alias, ty }) => {
282282
// Normalize goals derive from `AssociatedTyValue` datums,
283283
// which are found in impls. That is, if we are
284284
// normalizing (e.g.) `<T as Iterator>::Item>`, then
@@ -294,6 +294,35 @@ fn program_clauses_that_could_match<I: Interner>(
294294
let trait_id = associated_ty_datum.trait_id;
295295
let trait_parameters = db.trait_parameters_from_projection(alias);
296296

297+
if (alias
298+
.self_type_parameter(interner)
299+
.bound(interner)
300+
.is_some()
301+
|| alias
302+
.self_type_parameter(interner)
303+
.inference_var(interner)
304+
.is_some())
305+
&& (ty.bound(interner).is_some() || ty.inference_var(interner).is_some())
306+
{
307+
return Err(Floundered);
308+
}
309+
310+
let trait_datum = db.trait_datum(trait_id);
311+
312+
// FIXME
313+
if (alias
314+
.self_type_parameter(interner)
315+
.bound(interner)
316+
.is_some()
317+
|| alias
318+
.self_type_parameter(interner)
319+
.inference_var(interner)
320+
.is_some())
321+
&& trait_datum.is_non_enumerable_trait()
322+
{
323+
return Err(Floundered);
324+
}
325+
297326
push_program_clauses_for_associated_type_values_in_impls_of(
298327
builder,
299328
trait_id,

0 commit comments

Comments
 (0)