Is it possible to use concatcp (or a similar macro or function) for const fn parameters such as raw_name below? Or is such functionality only possible via macros?
error[E0080]: evaluation of constant value failed
--> src/token.rs:4:5
|
4 | concatcp!(SECONDARY_KEY_PREFIX, raw_name)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
= note: this error originates in the macro `$crate::pmr::__concatcp_impl` which comes from the expansion of the macro `concatcp` (in Nightly builds, run with -Z macro-backtrace for more info)
Constant functions are, well, functions. They can be called as ordinary, with runtime-defined parameters. The only difference is that, if they're called with compile-time constants, then they will yield a compile-time constant.
concatcp, on the other hand, is a macro. And macros are purely compile-time things - they can not use runtime-defined values in any way. Therefore, they can't use the const fn argument.