From 806c7281ec1905423aa4569d79940b59efc1905a Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Wed, 2 Dec 2020 15:38:37 +0100 Subject: [PATCH] add comment to `visit_ct_substs` --- compiler/rustc_infer/src/infer/combine.rs | 4 +--- compiler/rustc_middle/src/ty/relate.rs | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_infer/src/infer/combine.rs b/compiler/rustc_infer/src/infer/combine.rs index 594e2c6205f..987380304d2 100644 --- a/compiler/rustc_infer/src/infer/combine.rs +++ b/compiler/rustc_infer/src/infer/combine.rs @@ -881,9 +881,7 @@ fn tys(&mut self, t: Ty<'tcx>, _t: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { } } } - ty::Infer(ty::IntVar(_) | ty::FloatVar(_)) => { - Ok(t) - } + ty::Infer(ty::IntVar(_) | ty::FloatVar(_)) => Ok(t), _ => relate::super_relate_tys(self, t, t), } } diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 80dc7d89d18..ea4e731086f 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -33,6 +33,11 @@ pub trait TypeRelation<'tcx>: Sized { /// relation. Just affects error messages. fn a_is_expected(&self) -> bool; + /// Whether we should look into the substs of unevaluated constants + /// even if `feature(const_evaluatable_checked)` is active. + /// + /// This is needed in `combine` to prevent accidentially creating + /// infinite types as we abuse `TypeRelation` to walk a type there. fn visit_ct_substs(&self) -> bool { false }