about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Kuber <esteban@kuber.com.ar>2022-03-27 02:40:07 +0000
committerEsteban Kuber <esteban@kuber.com.ar>2022-03-27 02:40:07 +0000
commitf479e262d68271c1190dba6560923aff026d32fe (patch)
tree065bc4148a47f4709e59efd32aa48496ea89eec3
parent1db02b8a438aa3b0d6dcbf3628a5142eda0a8589 (diff)
downloadrust-f479e262d68271c1190dba6560923aff026d32fe.tar.gz
rust-f479e262d68271c1190dba6560923aff026d32fe.zip
review comments and rebase
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/mod.rs2
-rw-r--r--compiler/rustc_infer/src/infer/mod.rs16
-rw-r--r--compiler/rustc_typeck/src/astconv/generics.rs4
3 files changed, 10 insertions, 12 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs
index 78b21a235cb..238145c5c6e 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs
@@ -334,7 +334,7 @@ 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)
+            reg_a == reg_b && mut_a == mut_b && same_type_modulo_infer(*ty_a, *ty_b)
         }
         _ => a == b,
     }
diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs
index 5878cfdf0b7..83ba9c96978 100644
--- a/compiler/rustc_infer/src/infer/mod.rs
+++ b/compiler/rustc_infer/src/infer/mod.rs
@@ -1441,7 +1441,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
         if !value.needs_infer() {
             return value; // Avoid duplicated subst-folding.
         }
-        let mut r = InferenceLiteralEraser { infcx: self };
+        let mut r = InferenceLiteralEraser { tcx: self.tcx };
         value.fold_with(&mut r)
     }
 
@@ -1798,19 +1798,19 @@ impl<'tcx> TyOrConstInferVar<'tcx> {
 
 /// Replace `{integer}` with `i32` and `{float}` with `f64`.
 /// Used only for diagnostics.
-struct InferenceLiteralEraser<'a, 'tcx> {
-    infcx: &'a InferCtxt<'a, 'tcx>,
+struct InferenceLiteralEraser<'tcx> {
+    tcx: TyCtxt<'tcx>,
 }
 
-impl<'a, 'tcx> TypeFolder<'tcx> for InferenceLiteralEraser<'a, 'tcx> {
-    fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
-        self.infcx.tcx
+impl<'tcx> TypeFolder<'tcx> for InferenceLiteralEraser<'tcx> {
+    fn tcx(&self) -> TyCtxt<'tcx> {
+        self.tcx
     }
 
     fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
         match ty.kind() {
-            ty::Infer(ty::IntVar(_) | ty::FreshIntTy(_)) => self.tcx().types.i32,
-            ty::Infer(ty::FloatVar(_) | ty::FreshFloatTy(_)) => self.tcx().types.f64,
+            ty::Infer(ty::IntVar(_) | ty::FreshIntTy(_)) => self.tcx.types.i32,
+            ty::Infer(ty::FloatVar(_) | ty::FreshFloatTy(_)) => self.tcx.types.f64,
             _ => ty.super_fold_with(self),
         }
     }
diff --git a/compiler/rustc_typeck/src/astconv/generics.rs b/compiler/rustc_typeck/src/astconv/generics.rs
index 451e1e05d14..a07700aa9f5 100644
--- a/compiler/rustc_typeck/src/astconv/generics.rs
+++ b/compiler/rustc_typeck/src/astconv/generics.rs
@@ -85,9 +85,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                         let param_hir_id = tcx.hir().local_def_id_to_hir_id(param_local_id);
                         let param_name = tcx.hir().ty_param_name(param_hir_id);
                         let param_type = tcx.infer_ctxt().enter(|infcx| {
-                            infcx.resolve_numeric_literals_with_default(
-                                infcx.resolve_vars_if_possible(tcx.type_of(param.def_id)),
-                            )
+                            infcx.resolve_numeric_literals_with_default(tcx.type_of(param.def_id))
                         });
                         if param_type.is_suggestable() {
                             err.span_suggestion(