diff options
| author | Michael Goulet <michael@errs.io> | 2022-08-17 17:23:52 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-08-17 17:23:52 +0000 |
| commit | fc7fc0fae5079bc433a6e377b163a2a0757d65cd (patch) | |
| tree | 57b3f3fbe1847c1eb54ec002edebcec36742743f /compiler/rustc_infer | |
| parent | 86c6ebee8fa0a5ad1e18e375113b06bd2849b634 (diff) | |
| download | rust-fc7fc0fae5079bc433a6e377b163a2a0757d65cd.tar.gz rust-fc7fc0fae5079bc433a6e377b163a2a0757d65cd.zip | |
ty::Error does not match other types for region constraints
Diffstat (limited to 'compiler/rustc_infer')
| -rw-r--r-- | compiler/rustc_infer/src/infer/outlives/test_type_match.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs index 772e297b7b4..be03c8b5bae 100644 --- a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs +++ b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs @@ -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")] |
