Skip to content

Commit f479e26

Browse files
committed
review comments and rebase
1 parent 1db02b8 commit f479e26

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
334334
| (&ty::Infer(ty::InferTy::TyVar(_)), _)
335335
| (_, &ty::Infer(ty::InferTy::TyVar(_))) => true,
336336
(&ty::Ref(reg_a, ty_a, mut_a), &ty::Ref(reg_b, ty_b, mut_b)) => {
337-
reg_a == reg_b && mut_a == mut_b && same_type_modulo_infer(ty_a, ty_b)
337+
reg_a == reg_b && mut_a == mut_b && same_type_modulo_infer(*ty_a, *ty_b)
338338
}
339339
_ => a == b,
340340
}

compiler/rustc_infer/src/infer/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14411441
if !value.needs_infer() {
14421442
return value; // Avoid duplicated subst-folding.
14431443
}
1444-
let mut r = InferenceLiteralEraser { infcx: self };
1444+
let mut r = InferenceLiteralEraser { tcx: self.tcx };
14451445
value.fold_with(&mut r)
14461446
}
14471447

@@ -1798,19 +1798,19 @@ impl<'tcx> TyOrConstInferVar<'tcx> {
17981798

17991799
/// Replace `{integer}` with `i32` and `{float}` with `f64`.
18001800
/// Used only for diagnostics.
1801-
struct InferenceLiteralEraser<'a, 'tcx> {
1802-
infcx: &'a InferCtxt<'a, 'tcx>,
1801+
struct InferenceLiteralEraser<'tcx> {
1802+
tcx: TyCtxt<'tcx>,
18031803
}
18041804

1805-
impl<'a, 'tcx> TypeFolder<'tcx> for InferenceLiteralEraser<'a, 'tcx> {
1806-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
1807-
self.infcx.tcx
1805+
impl<'tcx> TypeFolder<'tcx> for InferenceLiteralEraser<'tcx> {
1806+
fn tcx(&self) -> TyCtxt<'tcx> {
1807+
self.tcx
18081808
}
18091809

18101810
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
18111811
match ty.kind() {
1812-
ty::Infer(ty::IntVar(_) | ty::FreshIntTy(_)) => self.tcx().types.i32,
1813-
ty::Infer(ty::FloatVar(_) | ty::FreshFloatTy(_)) => self.tcx().types.f64,
1812+
ty::Infer(ty::IntVar(_) | ty::FreshIntTy(_)) => self.tcx.types.i32,
1813+
ty::Infer(ty::FloatVar(_) | ty::FreshFloatTy(_)) => self.tcx.types.f64,
18141814
_ => ty.super_fold_with(self),
18151815
}
18161816
}

compiler/rustc_typeck/src/astconv/generics.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
8585
let param_hir_id = tcx.hir().local_def_id_to_hir_id(param_local_id);
8686
let param_name = tcx.hir().ty_param_name(param_hir_id);
8787
let param_type = tcx.infer_ctxt().enter(|infcx| {
88-
infcx.resolve_numeric_literals_with_default(
89-
infcx.resolve_vars_if_possible(tcx.type_of(param.def_id)),
90-
)
88+
infcx.resolve_numeric_literals_with_default(tcx.type_of(param.def_id))
9189
});
9290
if param_type.is_suggestable() {
9391
err.span_suggestion(

0 commit comments

Comments
 (0)