#E0149: change a running program cannot take
A hot-reload build (nabi dev, or nabic build --hot with --hot-base) is checked against the version the program runs now. The program's values stay alive across the change and are moved into the new layout field by field, so a type may:
- gain a field only with a default (
mana: i32 = 0;), which fills it in every live value; - lose, reorder, or rename fields (a renamed field says its old name with
#[renamed_from("hp")]); - gain, reorder, or lose enum variants.
It may not change the type of a field, name an old field that never existed in #[renamed_from], change its type parameters, or turn from a struct into an enum (or back). The program keeps running the old code; write the change the message suggests, or restart it (r in nabi dev).
error[E0149]: new field `mana` of `Player` needs a default while the program runs --> src/lib.nabi:1:12 | 1 | pub struct Player { | ^^^^^^ | = help: write `mana: i32 = 0;` (or restart with `r`)
Give the field a default:
pub struct Player {
pub name: str;
pub hp: i32 = 100;
pub mana: i32 = 0;
}
A field whose type changes is a new field: give it its own name and a default (health: f64 = 100.0) and drop the old one, or restart.
Related: E0132 invalid compiler option
Found a mistake? Edit this page on GitHub. Last updated