skip eq_types and sub_types when the two types are equal
This commit is contained in:
parent
956e2f8348
commit
73a09f35b1
1 changed files with 10 additions and 0 deletions
|
|
@ -759,6 +759,11 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
|||
sup: Ty<'tcx>,
|
||||
locations: Locations,
|
||||
) -> UnitResult<'tcx> {
|
||||
// Micro-optimization.
|
||||
if sub == sup {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
self.fully_perform_op(
|
||||
locations,
|
||||
|| format!("sub_types({:?} <: {:?})", sub, sup),
|
||||
|
|
@ -772,6 +777,11 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
|||
|
||||
#[inline(never)]
|
||||
fn eq_types(&mut self, a: Ty<'tcx>, b: Ty<'tcx>, locations: Locations) -> UnitResult<'tcx> {
|
||||
// Micro-optimization.
|
||||
if a == b {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
self.fully_perform_op(
|
||||
locations,
|
||||
|| format!("eq_types({:?} = {:?})", a, b),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue