Skip to content

Commit

Permalink
Make has_attr check behind effects feature
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Jun 30, 2024
1 parent bf750f5 commit a1157c7
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 a1157c7

Please sign in to comment.