1
Fork 0

lower impl const to bind to host effect param

This commit is contained in:
Deadbeef 2023-07-25 05:58:53 +00:00
parent 4f7bb9890c
commit 92f4c59e48
24 changed files with 236 additions and 137 deletions

View file

@ -1963,9 +1963,9 @@ impl<'tcx> TyCtxt<'tcx> {
matches!(
node,
hir::Node::Item(hir::Item {
kind: hir::ItemKind::Impl(hir::Impl { constness: hir::Constness::Const, .. }),
kind: hir::ItemKind::Impl(hir::Impl { generics, .. }),
..
})
}) if generics.params.iter().any(|p| self.has_attr(p.def_id, sym::rustc_host))
)
}

View file

@ -2841,6 +2841,11 @@ define_print_and_forward_display! {
ty::TraitPredicate<'tcx> {
p!(print(self.trait_ref.self_ty()), ": ");
if let Some(idx) = cx.tcx().generics_of(self.trait_ref.def_id).host_effect_index {
if self.trait_ref.args.const_at(idx) != cx.tcx().consts.true_ {
p!("~const ");
}
}
// FIXME(effects) print `~const` here
if let ty::ImplPolarity::Negative = self.polarity {
p!("!");