Rollup merge of #99704 - fee1-dead-contrib:add_self_tilde_const_trait, r=oli-obk
Add `Self: ~const Trait` to traits with `#[const_trait]` r? `@oli-obk`
This commit is contained in:
commit
28b44ff5d4
30 changed files with 199 additions and 209 deletions
|
@ -829,6 +829,14 @@ impl<'tcx> TraitPredicate<'tcx> {
|
|||
pub fn is_const_if_const(self) -> bool {
|
||||
self.constness == BoundConstness::ConstIfConst
|
||||
}
|
||||
|
||||
pub fn is_constness_satisfied_by(self, constness: hir::Constness) -> bool {
|
||||
match (self.constness, constness) {
|
||||
(BoundConstness::NotConst, _)
|
||||
| (BoundConstness::ConstIfConst, hir::Constness::Const) => true,
|
||||
(BoundConstness::ConstIfConst, hir::Constness::NotConst) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> PolyTraitPredicate<'tcx> {
|
||||
|
|
|
@ -2556,7 +2556,7 @@ define_print_and_forward_display! {
|
|||
|
||||
ty::TraitPredicate<'tcx> {
|
||||
p!(print(self.trait_ref.self_ty()), ": ");
|
||||
if let ty::BoundConstness::ConstIfConst = self.constness {
|
||||
if let ty::BoundConstness::ConstIfConst = self.constness && cx.tcx().features().const_trait_impl {
|
||||
p!("~const ");
|
||||
}
|
||||
p!(print(self.trait_ref.print_only_trait_path()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue