Skip to content

Commit

Permalink
Reuse ErrorGuaranteed during relation
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jan 11, 2023
1 parent ef4046e commit 4e30ad8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion compiler/rustc_middle/src/ty/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
Err(TypeError::Sorts(relate::expected_found(self, a, b)))
}

(&ty::Error(_), _) | (_, &ty::Error(_)) => Ok(self.tcx().ty_error()),
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => {
Ok(self.tcx().ty_error_with_guaranteed(guar))
}

_ => relate::super_relate_tys(self, a, b),
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/relate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
bug!("bound types encountered in super_relate_tys")
}

(&ty::Error(_), _) | (_, &ty::Error(_)) => Ok(tcx.ty_error()),
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(tcx.ty_error_with_guaranteed(guar)),

(&ty::Never, _)
| (&ty::Char, _)
Expand Down

0 comments on commit 4e30ad8

Please sign in to comment.