Skip to content

Commit ecdf7f0

Browse files
Reuse ErrorGuaranteed during relation
1 parent 7742995 commit ecdf7f0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/rustc_middle/src/ty/_match.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
8989
Err(TypeError::Sorts(relate::expected_found(self, a, b)))
9090
}
9191

92-
(&ty::Error(_), _) | (_, &ty::Error(_)) => Ok(self.tcx().ty_error()),
92+
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => {
93+
Ok(self.tcx().ty_error_with_guaranteed(guar))
94+
}
9395

9496
_ => relate::super_relate_tys(self, a, b),
9597
}

compiler/rustc_middle/src/ty/relate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
414414
bug!("bound types encountered in super_relate_tys")
415415
}
416416

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

419419
(&ty::Never, _)
420420
| (&ty::Char, _)

0 commit comments

Comments
 (0)