4 ms·
Rust cannot take a const function and evaluate that into the argument of a const generic or a proc macro. As far as I can tell, the reasons are deeply fundament
by Conscat 6mo ago
Rust cannot take a const function and evaluate that into the argument of a const generic or a proc macro. As far as I can tell, the reasons are deeply fundamental to the architecture of rustc. It's difficult to express HOW FUNDAMENTAL this is to strongly typed zero overhead abstractions, and we see where Rust is lacking here in cases like `Option` and bitset implementations.
- aw1621107 6mo ago> Rust cannot take a const function and evaluate that into the argument of a const generic Assuming I'm interpreting what you're saying here correctly, this seems wrong? For example, this compiles [0]: const fn foo(n: usize) -> usize { n + 1 } fn bar<const N: usize>() -> usize { N + 1 } pub fn baz() -> usize { bar::<{foo(0)}>() } In any case, I'm a little confused how this is relevant to what I said? [0]: https://rust.godbolt.org/z/rrE1Wrx36 https://rust.godbolt.org/z/rrE1Wrx36