From 7467c3a45c995fd47b70028b143be23f9616949d Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 9 Dec 2023 17:43:01 +0000 Subject: [PATCH] s/const_effect/host_effect --- .../src/transform/check_consts/qualifs.rs | 2 +- compiler/rustc_hir_typeck/src/callee.rs | 2 +- compiler/rustc_middle/src/ty/util.rs | 11 ++++++----- compiler/rustc_mir_build/src/build/matches/test.rs | 2 +- .../rustc_mir_build/src/thir/pattern/const_to_pat.rs | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs index d5f418e1710..7e1cbfe6667 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs @@ -172,7 +172,7 @@ fn in_any_value_of_ty<'tcx>(cx: &ConstCx<'_, 'tcx>, ty: Ty<'tcx>) -> bool { destruct_def_id, [ ty::GenericArg::from(ty), - ty::GenericArg::from(cx.tcx.expected_const_effect_param_for_body(cx.def_id())), + ty::GenericArg::from(cx.tcx.expected_host_effect_param_for_body(cx.def_id())), ], ), ); diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs index a907acba0e0..512946cc504 100644 --- a/compiler/rustc_hir_typeck/src/callee.rs +++ b/compiler/rustc_hir_typeck/src/callee.rs @@ -780,7 +780,7 @@ pub(super) fn enforce_context_effects( let generics = tcx.generics_of(callee_did); let Some(host_effect_index) = generics.host_effect_index else { return }; - let effect = tcx.expected_const_effect_param_for_body(self.body_id); + let effect = tcx.expected_host_effect_param_for_body(self.body_id); trace!(?effect, ?generics, ?callee_args); diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index b7c3edee9e5..1da090a7e46 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -782,7 +782,7 @@ pub fn is_user_visible_dep(self, key: CrateNum) -> bool { || self.extern_crate(key.as_def_id()).is_some_and(|e| e.is_direct()) } - pub fn expected_const_effect_param_for_body(self, def_id: LocalDefId) -> ty::Const<'tcx> { + pub fn expected_host_effect_param_for_body(self, def_id: LocalDefId) -> ty::Const<'tcx> { // FIXME(effects): This is suspicious and should probably not be done, // especially now that we enforce host effects and then properly handle // effect vars during fallback. @@ -817,7 +817,7 @@ pub fn expected_const_effect_param_for_body(self, def_id: LocalDefId) -> ty::Con } /// Constructs generic args for an item, optionally appending a const effect param type - pub fn with_opt_const_effect_param( + pub fn with_opt_host_effect_param( self, caller_def_id: LocalDefId, callee_def_id: DefId, @@ -826,9 +826,10 @@ pub fn with_opt_const_effect_param( let generics = self.generics_of(callee_def_id); assert_eq!(generics.parent, None); - let opt_const_param = generics.host_effect_index.is_some().then(|| { - ty::GenericArg::from(self.expected_const_effect_param_for_body(caller_def_id)) - }); + let opt_const_param = generics + .host_effect_index + .is_some() + .then(|| ty::GenericArg::from(self.expected_host_effect_param_for_body(caller_def_id))); self.mk_args_from_iter(args.into_iter().map(|arg| arg.into()).chain(opt_const_param)) } diff --git a/compiler/rustc_mir_build/src/build/matches/test.rs b/compiler/rustc_mir_build/src/build/matches/test.rs index 642ac9b49c8..d1952704da3 100644 --- a/compiler/rustc_mir_build/src/build/matches/test.rs +++ b/compiler/rustc_mir_build/src/build/matches/test.rs @@ -500,7 +500,7 @@ fn non_scalar_compare( self.tcx, eq_def_id, sym::eq, - self.tcx.with_opt_const_effect_param(self.def_id, eq_def_id, [ty, ty]), + self.tcx.with_opt_host_effect_param(self.def_id, eq_def_id, [ty, ty]), ); let bool_ty = self.tcx.types.bool; diff --git a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs index 4e2c932d6c6..391d65b338d 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs @@ -272,7 +272,7 @@ fn type_has_partial_eq_impl(&self, ty: Ty<'tcx>) -> bool { ty::TraitRef::new( tcx, partial_eq_trait_id, - tcx.with_opt_const_effect_param( + tcx.with_opt_host_effect_param( tcx.hir().enclosing_body_owner(self.id), partial_eq_trait_id, [ty, ty],