docs

You are reading the docs for v0.1.0. Nabi 0.1.0 is no longer supported. Latest release: v0.1.3 →

#E0066: using on a value without Drop

using releases its resource at the end of the block, so the resource's type must implement Drop or hold a Drop field. Use a plain let for other values.

nabi
using n = 3 {
    println(f"{n}");
}
error[E0066]: `using` needs a resource whose type implements `Drop`; `i64` does not implement `Drop` nor hold a `Drop` field
  --> main.nabi:1:7
   |
 1 | using n = 3 {
   |       ^

Use a plain let:

nabi
let n = 3;
println(f"{n}");
3

Related: E0065 lock guard not released by using, E0092 Drop::drop called directly

Found a mistake? Edit this page on GitHub. Last updated