@@ -530,16 +530,14 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
530
530
assert ! ( self . values_are_none( ) ) ;
531
531
532
532
debug ! ( "RegionVarBindings: lub_regions({:?}, {:?})" , a, b) ;
533
- match ( a, b) {
534
- ( ReStatic , _) | ( _, ReStatic ) => {
535
- ReStatic // nothing lives longer than static
536
- }
537
-
538
- _ => {
539
- self . combine_vars ( Lub , a, b, origin. clone ( ) , |this, old_r, new_r| {
540
- this. make_subregion ( origin. clone ( ) , old_r, new_r)
541
- } )
542
- }
533
+ if a == ty:: ReStatic || b == ty:: ReStatic {
534
+ ReStatic // nothing lives longer than static
535
+ } else if a == b {
536
+ a // LUB(a,a) = a
537
+ } else {
538
+ self . combine_vars ( Lub , a, b, origin. clone ( ) , |this, old_r, new_r| {
539
+ this. make_subregion ( origin. clone ( ) , old_r, new_r)
540
+ } )
543
541
}
544
542
}
545
543
@@ -550,8 +548,11 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
550
548
debug ! ( "RegionVarBindings: glb_regions({:?}, {:?})" , a, b) ;
551
549
match ( a, b) {
552
550
( ReStatic , r) | ( r, ReStatic ) => {
553
- // static lives longer than everything else
554
- r
551
+ r // static lives longer than everything else
552
+ }
553
+
554
+ _ if a == b => {
555
+ a // GLB(a,a) = a
555
556
}
556
557
557
558
_ => {
0 commit comments