In Rust, `const` functions are quite limited in what code can be put inside them, e.g. `for` loops aren't allowed, nor are any non-`const` function calls. I understand that there are issues with heap allocations in `const` functions, but why is it that for example the below code isn't valid:

```rust
fn add(a: u8, b: u8) -> u8 {
    a + b
}
const A: u8 = add(1, 2);

```

This would be valid if `add` was declared as a `const` function, so I don't why the Rust compiler can't detect that this is valid; so I guess I'm also asking why `const` functions are necessary at all, and why even `for` loops aren't allowed inside them (even though while loops are).