Skip to content

Commit

Permalink
Auto merge of rust-lang#127144 - fee1-dead-contrib:newfx2, r=<try>
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Jun 30, 2024
2 parents bf750f5 + a1157c7 commit 0c92609
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions compiler/rustc_hir_typeck/src/method/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// FIXME(effects) find a better way to do this
// Operators don't have generic methods, but making them `#[const_trait]` gives them
// `const host: bool`.
let args = if self.tcx.has_attr(trait_def_id, sym::const_trait) {
self.tcx.mk_args_from_iter(
args.iter()
.chain([self.tcx.expected_host_effect_param_for_body(self.body_id).into()]),
)
} else {
args
};
let args =
if self.tcx.features().effects && self.tcx.has_attr(trait_def_id, sym::const_trait) {
self.tcx.mk_args_from_iter(
args.iter()
.chain([self.tcx.expected_host_effect_param_for_body(self.body_id).into()]),
)
} else {
args
};
self.construct_obligation_for_trait(m_name, trait_def_id, obligation, args)
}

Expand Down

0 comments on commit 0c92609

Please sign in to comment.