const_trait_impl
: investigate how to put Self: ~const Trait
bounds in traits
#92158
Labels
A-const-fn
Area: const fn foo(..) {..}. Pure functions which can be applied at compile time.
F-const_trait_impl
`#![feature(const_trait_impl)]`
The
predicates_of
query currently insertsSelf: Trait
as a generic predicate for traits. This could becomeSelf: ~const Trait
and probably resolves some of the hackery arounddefault_method_body_is_const
. For example, we have explicitly allowed calling other methods inside the same trait fordefault_method_body_is_const
bodies during const checking. If we hadSelf: ~const Trait
as a caller bound then we don't need to explicitly allow this.There is also another issue that would be resolved by this:
The snippet above currently fails to compile. If we had
Self: ~const Foo
then it would work.The problem is that I tried doing this and there was a lot of mysterious errors. So I limited
Self: ~const Trait
todefault_method_body_is_const
methods. It compiled but some ui tests related to object safety fails after the change. Below is the diff of my current progress:The text was updated successfully, but these errors were encountered: