Skip to content

Commit 25306f1

Browse files
committed
[experiment] turn on effects everywhere
1 parent 8681e07 commit 25306f1

File tree

7 files changed

+7
-17
lines changed

7 files changed

+7
-17
lines changed

compiler/rustc_ast_lowering/src/item.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
571571
hir::ItemKind::Impl(impl_) => {
572572
self.is_in_trait_impl = impl_.of_trait.is_some();
573573
}
574-
hir::ItemKind::Trait(_, _, generics, _, _) if self.tcx.features().effects => {
574+
hir::ItemKind::Trait(_, _, generics, _, _) => {
575575
self.host_param_id = generics
576576
.params
577577
.iter()
@@ -1384,9 +1384,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
13841384
// Desugar `~const` bound in generics into an additional `const host: bool` param
13851385
// if the effects feature is enabled. This needs to be done before we lower where
13861386
// clauses since where clauses need to bind to the DefId of the host param
1387-
let host_param_parts = if let Const::Yes(span) = constness
1388-
&& self.tcx.features().effects
1389-
{
1387+
let host_param_parts = if let Const::Yes(span) = constness {
13901388
let span = self.lower_span(span);
13911389
let param_node_id = self.next_node_id();
13921390
let hir_id = self.next_id();

compiler/rustc_ast_lowering/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -2557,10 +2557,6 @@ struct GenericArgsCtor<'hir> {
25572557

25582558
impl<'hir> GenericArgsCtor<'hir> {
25592559
fn push_constness(&mut self, lcx: &mut LoweringContext<'_, 'hir>, constness: ast::Const) {
2560-
if !lcx.tcx.features().effects {
2561-
return;
2562-
}
2563-
25642560
// if bound is non-const, don't add host effect param
25652561
let ast::Const::Yes(span) = constness else { return };
25662562

compiler/rustc_const_eval/src/transform/check_consts/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
779779
};
780780

781781
match implsrc {
782-
Ok(Some(ImplSource::Param(_))) if tcx.features().effects => {
782+
Ok(Some(ImplSource::Param(_))) => {
783783
debug!(
784784
"const_trait_impl: provided {:?} via where-clause in {:?}",
785785
trait_ref, param_env

compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ impl Qualif for NeedsNonConstDrop {
157157
// FIXME(effects): If `destruct` is not a `const_trait`,
158158
// or effects are disabled in this crate, then give up.
159159
let destruct_def_id = cx.tcx.require_lang_item(LangItem::Destruct, Some(cx.body.span));
160-
if cx.tcx.generics_of(destruct_def_id).host_effect_index.is_none()
161-
|| !cx.tcx.features().effects
162-
{
160+
if cx.tcx.generics_of(destruct_def_id).host_effect_index.is_none() {
163161
return NeedsDrop::in_any_value_of_ty(cx, ty);
164162
}
165163

compiler/rustc_hir_analysis/src/bounds.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ impl<'tcx> Bounds<'tcx> {
4747
self.push_trait_bound_inner(tcx, trait_ref, span, polarity);
4848

4949
// push a non-const (`host = true`) version of the bound if it is `~const`.
50-
if tcx.features().effects
51-
&& let Some(host_effect_idx) = tcx.generics_of(trait_ref.def_id()).host_effect_index
50+
if let Some(host_effect_idx) = tcx.generics_of(trait_ref.def_id()).host_effect_index
5251
&& trait_ref.skip_binder().args.const_at(host_effect_idx) != tcx.consts.true_
5352
{
5453
let generics = tcx.generics_of(trait_ref.def_id());

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(super) fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredic
3838
// an obligation and instead be skipped. Otherwise we'd use
3939
// `tcx.def_span(def_id);`
4040
let span = rustc_span::DUMMY_SP;
41-
let non_const_bound = if tcx.features().effects && tcx.has_attr(def_id, sym::const_trait) {
41+
let non_const_bound = if tcx.has_attr(def_id, sym::const_trait) {
4242
// when `Self` is a const trait, also add `Self: Trait<.., true>` as implied bound,
4343
// because only implementing `Self: Trait<.., false>` is currently not possible.
4444
Some((

compiler/rustc_middle/src/ty/util.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,7 @@ impl<'tcx> TyCtxt<'tcx> {
784784
// FIXME(effects): This is suspicious and should probably not be done,
785785
// especially now that we enforce host effects and then properly handle
786786
// effect vars during fallback.
787-
let mut host_always_on =
788-
!self.features().effects || self.sess.opts.unstable_opts.unleash_the_miri_inside_of_you;
787+
let mut host_always_on = self.sess.opts.unstable_opts.unleash_the_miri_inside_of_you;
789788

790789
// Compute the constness required by the context.
791790
let const_context = self.hir().body_const_context(def_id);

0 commit comments

Comments
 (0)