Skip to content

Commit 4c2cb04

Browse files
committed
Fix tests by floundering on general bound vars in builtin trait code
1 parent 6368af3 commit 4c2cb04

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

chalk-solve/src/clauses/builtin_traits/copy.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ pub fn add_copy_program_clauses<I: Interner>(
8181
match var_kind {
8282
VariableKind::Ty(TyVariableKind::Integer)
8383
| VariableKind::Ty(TyVariableKind::Float) => builder.push_fact(trait_ref),
84-
VariableKind::Ty(_) | VariableKind::Const(_) | VariableKind::Lifetime => {}
84+
85+
// Don't know enough
86+
VariableKind::Ty(TyVariableKind::General) => return Err(Floundered),
87+
88+
VariableKind::Const(_) | VariableKind::Lifetime => {}
8589
}
8690
}
8791

chalk-solve/src/clauses/builtin_traits/fn_family.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub fn add_fn_trait_program_clauses<I: Interner>(
157157
Ok(())
158158
}
159159
// Function traits are non-enumerable
160-
TyKind::InferenceVar(..) | TyKind::Alias(..) => Err(Floundered),
160+
TyKind::InferenceVar(..) | TyKind::BoundVar(_) | TyKind::Alias(..) => Err(Floundered),
161161
_ => Ok(()),
162162
}
163163
}

chalk-solve/src/clauses/builtin_traits/sized.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ pub fn add_sized_program_clauses<I: Interner>(
106106
match var_kind {
107107
VariableKind::Ty(TyVariableKind::Integer)
108108
| VariableKind::Ty(TyVariableKind::Float) => builder.push_fact(trait_ref),
109-
VariableKind::Ty(_) | VariableKind::Const(_) | VariableKind::Lifetime => {}
109+
110+
// Don't know enough
111+
VariableKind::Ty(TyVariableKind::General) => return Err(Floundered),
112+
113+
VariableKind::Const(_) | VariableKind::Lifetime => {}
110114
}
111115
}
112116

tests/test/misc.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -537,28 +537,19 @@ fn builtin_impl_enumeration() {
537537

538538
goal {
539539
exists<T> { T: Copy }
540-
} yields[SolverChoice::recursive_default()] {
541-
// FIXME: wrong, e.g. &u8 is also Copy
542-
"Unique; substitution [?0 := Uint(U8)]"
543-
} yields[SolverChoice::slg_default()] {
540+
} yields {
544541
"Ambiguous; no inference guidance"
545542
}
546543

547544
goal {
548545
exists<T> { T: Clone }
549-
} yields[SolverChoice::recursive_default()] {
550-
// FIXME: wrong, e.g. &u8 is also Clone
551-
"Unique; substitution [?0 := Uint(U8)]"
552-
} yields[SolverChoice::slg_default()] {
546+
} yields {
553547
"Ambiguous; no inference guidance"
554548
}
555549

556550
goal {
557551
exists<T> { T: Sized }
558-
} yields[SolverChoice::recursive_default()] {
559-
// FIXME: wrong, most of the built-in types are Sized
560-
"No possible solution"
561-
} yields[SolverChoice::slg_default()] {
552+
} yields {
562553
"Ambiguous; no inference guidance"
563554
}
564555
}

0 commit comments

Comments
 (0)