Skip to content

Commit 0c92609

Browse files
committed
Auto merge of rust-lang#127144 - fee1-dead-contrib:newfx2, r=<try>
Make `has_attr` check behind effects feature attempt to fix the performance regression in rust-lang#120639. cc rust-lang#110395 r? project-const-traits
2 parents bf750f5 + a1157c7 commit 0c92609

File tree

1 file changed

+9
-8
lines changed
  • compiler/rustc_hir_typeck/src/method

1 file changed

+9
-8
lines changed

compiler/rustc_hir_typeck/src/method/mod.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
359359
// FIXME(effects) find a better way to do this
360360
// Operators don't have generic methods, but making them `#[const_trait]` gives them
361361
// `const host: bool`.
362-
let args = if self.tcx.has_attr(trait_def_id, sym::const_trait) {
363-
self.tcx.mk_args_from_iter(
364-
args.iter()
365-
.chain([self.tcx.expected_host_effect_param_for_body(self.body_id).into()]),
366-
)
367-
} else {
368-
args
369-
};
362+
let args =
363+
if self.tcx.features().effects && self.tcx.has_attr(trait_def_id, sym::const_trait) {
364+
self.tcx.mk_args_from_iter(
365+
args.iter()
366+
.chain([self.tcx.expected_host_effect_param_for_body(self.body_id).into()]),
367+
)
368+
} else {
369+
args
370+
};
370371
self.construct_obligation_for_trait(m_name, trait_def_id, obligation, args)
371372
}
372373

0 commit comments

Comments
 (0)