As part of #67792, #[derive_const]
is the current way to indicate that a derive should be impl const Trait
rather than impl Trait
. However, this only works for built-in macros. It should be possible for end-user proc macros to know if they were invoked with #[derive_const]
, permitting the derive to emit the appropriate code.
In my opinion, this could be an opaque type provided as an additional parameter to the derive implementation. That type would have methods to obtain constness and any other future extension (i.e. effects).
cc @fee1-dead per this Zulip comment.
@rustbot label +A-proc-macros +C-enhancement +F-const-trait-impl +T-libs-api
compiler-errors, fee1-dead, mati865, KisaragiEffective and VladasZ
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4