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列挙型の判別子の設定に書ける式も