Skip to content

Commit fb621b6

Browse files
committed
dyn ~const Trait as an argument for implicit ~const Destruct
1 parent 328655a commit fb621b6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

text/0000-const-trait-impls.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,10 @@ In practice we have noticed that a large portion of APIs will have a `~const Des
545545
This bound has little value as an explicit bound that appears almost everywhere.
546546
Especially since it is a fairly straight forward assumption that a type that has const trait impls will also have a `const Drop` impl or only contain `const Destruct` types.
547547

548+
In the future we will also want to support `dyn ~const Trait` bounds, which invariably will require the type to implement `~const Destruct` in order to fill in the function pointer for the `drop` slot in the vtable.
549+
While that can in generic contexts always be handled by adding more `~const Destruct` bounds, it would be more similar to how normal `dyn` safety
550+
works if there were implicit `~const Destruct` bounds for (most?) `~const Trait` bounds.
551+
548552
Thus we give all `const trait`s a `~const Destruct` super trait to ensure users don't need to add `~const Destruct` bounds everywhere.
549553
We may offer an opt out of this behaviour in the future, if there are convincing real world use cases.
550554

0 commit comments

Comments
 (0)