I am currently trying to have a function you can only call/compile when a given associated const is true. My current try is: Rust Playground, but that is not successful as it gives me this error:
error: generic parameters may not be used in const operations
--> src/main.rs:19:13
|
19 | Check<{ T::STREAM }>: True,
| ^^^^^^^^^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
I understand that this area of Rust is still a WIP, but is there an alternative I could use? I am fine with it producing potentially confusing errors.
Basically a desugared inline_const. But it get the work done.
edit: P.S. I actually don't really like a post-mono error approach like this. But if this is your only reasonable approach then do it. But you need to provide a reason why T: Accept<STREAM = true> is not acceptable.