1
Fork 0

Rollup merge of #133323 - compiler-errors:bail-if-self-var, r=lcnr

Bail in effects in old solver if self ty is ty var

Otherwise when we try to check something like `?t: ~const Trait` we'll immediately stick it to the first param-env candidate, lol.

r? lcnr
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-11-22 20:32:37 +08:00 committed by GitHub
commit 74b8522855
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View file

@ -27,6 +27,11 @@ pub fn evaluate_host_effect_obligation<'tcx>(
);
}
// Force ambiguity for infer self ty.
if obligation.predicate.self_ty().is_ty_var() {
return Err(EvaluationFailure::Ambiguous);
}
match evaluate_host_effect_from_bounds(selcx, obligation) {
Ok(result) => return Ok(result),
Err(EvaluationFailure::Ambiguous) => return Err(EvaluationFailure::Ambiguous),