@@ -665,21 +665,22 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
665
665
666
666
fn push_ty_ref < ' tcx > (
667
667
r : & ty:: Region < ' tcx > ,
668
- tnm : & ty:: TypeAndMut < ' tcx > ,
668
+ ty : Ty < ' tcx > ,
669
+ mutbl : hir:: Mutability ,
669
670
s : & mut DiagnosticStyledString ,
670
671
) {
671
672
let r = & format ! ( "{}" , r) ;
672
673
s. push_highlighted ( format ! (
673
674
"&{}{}{}" ,
674
675
r,
675
676
if r == "" { "" } else { " " } ,
676
- if tnm . mutbl == hir:: MutMutable {
677
+ if mutbl == hir:: MutMutable {
677
678
"mut "
678
679
} else {
679
680
""
680
681
}
681
682
) ) ;
682
- s. push_normal ( format ! ( "{}" , tnm . ty) ) ;
683
+ s. push_normal ( format ! ( "{}" , ty) ) ;
683
684
}
684
685
685
686
match ( & t1. sty , & t2. sty ) {
@@ -803,24 +804,25 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
803
804
}
804
805
805
806
// When finding T != &T, highlight only the borrow
806
- ( & ty:: TyRef ( r1, ref tnm1 ) , _) if equals ( & tnm1 . ty , & t2) => {
807
+ ( & ty:: TyRef ( r1, ref_ty1 , mutbl1 ) , _) if equals ( & ref_ty1 , & t2) => {
807
808
let mut values = ( DiagnosticStyledString :: new ( ) , DiagnosticStyledString :: new ( ) ) ;
808
- push_ty_ref ( & r1, tnm1 , & mut values. 0 ) ;
809
+ push_ty_ref ( & r1, ref_ty1 , mutbl1 , & mut values. 0 ) ;
809
810
values. 1 . push_normal ( format ! ( "{}" , t2) ) ;
810
811
values
811
812
}
812
- ( _, & ty:: TyRef ( r2, ref tnm2 ) ) if equals ( & t1, & tnm2 . ty ) => {
813
+ ( _, & ty:: TyRef ( r2, ref_ty2 , mutbl2 ) ) if equals ( & t1, & ref_ty2 ) => {
813
814
let mut values = ( DiagnosticStyledString :: new ( ) , DiagnosticStyledString :: new ( ) ) ;
814
815
values. 0 . push_normal ( format ! ( "{}" , t1) ) ;
815
- push_ty_ref ( & r2, tnm2 , & mut values. 1 ) ;
816
+ push_ty_ref ( & r2, ref_ty2 , mutbl2 , & mut values. 1 ) ;
816
817
values
817
818
}
818
819
819
820
// When encountering &T != &mut T, highlight only the borrow
820
- ( & ty:: TyRef ( r1, ref tnm1) , & ty:: TyRef ( r2, ref tnm2) ) if equals ( & tnm1. ty , & tnm2. ty ) => {
821
+ ( & ty:: TyRef ( r1, ref_ty1, mutbl1) ,
822
+ & ty:: TyRef ( r2, ref_ty2, mutbl2) ) if equals ( & ref_ty1, & ref_ty2) => {
821
823
let mut values = ( DiagnosticStyledString :: new ( ) , DiagnosticStyledString :: new ( ) ) ;
822
- push_ty_ref ( & r1, tnm1 , & mut values. 0 ) ;
823
- push_ty_ref ( & r2, tnm2 , & mut values. 1 ) ;
824
+ push_ty_ref ( & r1, ref_ty1 , mutbl1 , & mut values. 0 ) ;
825
+ push_ty_ref ( & r2, ref_ty2 , mutbl2 , & mut values. 1 ) ;
824
826
values
825
827
}
826
828
0 commit comments