Rollup merge of #122360 - veera-sivarajan:bugfix-121941, r=compiler-errors
Don't Create `ParamCandidate` When Obligation Contains Errors Fixes #121941 I'm not sure if I understand this correctly but this bug was caused by an error type incorrectly matching against `ParamCandidate`. This was introduced by the changes made in #72621 (figured using cargo-bisect-rustc). This PR fixes it by skipping `ParamCandidate` generation when an error type is involved. Also, this is similar to #73005 but addresses `ParamCandidate` instead of `ImplCandidate`.
This commit is contained in:
commit
5d131407da
3 changed files with 21 additions and 0 deletions
|
@ -219,6 +219,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
) -> Result<(), SelectionError<'tcx>> {
|
||||
debug!(?stack.obligation);
|
||||
|
||||
// An error type will unify with anything. So, avoid
|
||||
// matching an error type with `ParamCandidate`.
|
||||
// This helps us avoid spurious errors like issue #121941.
|
||||
if stack.obligation.predicate.references_error() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let all_bounds = stack
|
||||
.obligation
|
||||
.param_env
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue