E1006: use of a dropped binding

View source

drop releases a resource at once.

drop releases a resource at once. ADR-0027 makes the release happen exactly once, so the binding is dead afterwards and any later read, borrow or move is rejected. The error points at the later use.

Example

actus
verb main() {
    erg data: Buffer = Buffer[4];
    drop(data);
    println(int: buffer_length(buffer: abs data));
}

Fix

Assign the binding a new value. The assignment reads nothing and releases nothing, because drop already released the old value, and it makes the binding live again (ADR-0132). A second drop is still E1007:

actus
verb main() {
    erg data: Buffer = Buffer[4];
    drop(data);
    data = Buffer[8];
    println(int: buffer_length(buffer: abs data));
}

Otherwise use the value before it is dropped. Most owners need no drop at all, because the compiler releases them at the end of their scope.

actus
verb main() {
    erg data: Buffer = Buffer[4];
    println(int: buffer_length(buffer: abs data));
    drop(data);
}

Run actus explain E1006 in your terminal to read this entry offline. Browse Ownership & types or all error codes.