Skip to content

Commit

Permalink
s/const_effect/host_effect
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Dec 9, 2023
1 parent f1bf874 commit 7467c3a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl Qualif for NeedsNonConstDrop {
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())),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
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);

Expand Down
11 changes: 6 additions & 5 deletions compiler/rustc_middle/src/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ impl<'tcx> TyCtxt<'tcx> {
|| 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.
Expand Down Expand Up @@ -817,7 +817,7 @@ impl<'tcx> TyCtxt<'tcx> {
}

/// 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,
Expand All @@ -826,9 +826,10 @@ impl<'tcx> TyCtxt<'tcx> {
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))
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/matches/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
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;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ impl<'tcx> ConstToPat<'tcx> {
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],
Expand Down

0 comments on commit 7467c3a

Please sign in to comment.