From b09420f95a719c85e60b501955d356b1c34abf16 Mon Sep 17 00:00:00 2001 From: Esteban Kuber Date: Wed, 15 Dec 2021 23:25:03 +0000 Subject: [PATCH] Drive by: handle references in `same_type_modulo_infer` --- compiler/rustc_infer/src/infer/error_reporting/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index f1c21f59239..78b21a235cb 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -333,6 +333,9 @@ pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool { ) | (&ty::Infer(ty::InferTy::TyVar(_)), _) | (_, &ty::Infer(ty::InferTy::TyVar(_))) => true, + (&ty::Ref(reg_a, ty_a, mut_a), &ty::Ref(reg_b, ty_b, mut_b)) => { + reg_a == reg_b && mut_a == mut_b && same_type_modulo_infer(ty_a, ty_b) + } _ => a == b, } }