1
Fork 0

Rollup merge of #100688 - compiler-errors:issue-100684, r=wesleywiser

`ty::Error` does not match other types for region constraints

Fixes #100684
This commit is contained in:
Matthias Krüger 2022-08-18 05:10:51 +02:00 committed by GitHub
commit c7a4942588
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 1 deletions

View file

@ -174,7 +174,14 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
#[instrument(skip(self), level = "debug")]
fn tys(&mut self, pattern: Ty<'tcx>, value: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
if pattern == value { Ok(pattern) } else { relate::super_relate_tys(self, pattern, value) }
if let ty::Error(_) = pattern.kind() {
// Unlike normal `TypeRelation` rules, `ty::Error` does not equal any type.
self.no_match()
} else if pattern == value {
Ok(pattern)
} else {
relate::super_relate_tys(self, pattern, value)
}
}
#[instrument(skip(self), level = "debug")]