E1008: drop of a borrowed parameter

View source

drop is for owners.

drop is for owners. An abs view and an ins loan are non-owning, and ADR-0027 says they never receive an owned drop. The caller still owns the value and releases it. The error points at the drop statement.

Example

actus
verb eat(ins data: Buffer) {
    drop(data);
}

verb main() {
}

Fix

If the callee should end the life of the value, declare the parameter dat. The caller then gives up ownership, and the callee may drop it.

actus
verb eat(dat data: Buffer) {
    drop(data);
}

verb main() {
}

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