error[E0010]: allocations are not allowed in constants --> const.rs:1:23 | 1 | const VEC: Vec<i32> = vec![1]; | ^^^^^^^ allocation not allowed in constants | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) この制限された static や const の右辺に書くときの文脈を const文脈 と呼びます。 この他には配列初期化構文 [init; size] の size の部分やその型 [Type; Size] の Size 、あとはC-like列挙型の判別子の設定に書ける式も
![Rustのconst fnって何? | κeenのHappy Hacκing Blog](https://cdn-ak-scissors.b.st-hatena.com/image/square/3356040fd4afcff53dc9ff2c9fccd4cab00b6548/height=288;version=1;width=512/https%3A%2F%2Fkeens.github.io%2Fimages%2Fogp%2Fpost%2FRustnoconst_fnttenani_.png)