#E0066: 对没有 Drop 的值使用 using
using 在块结束时释放它的资源,所以资源的类型必须实现 Drop 或者含有 Drop 字段。其他值使用普通的 let。
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 { | ^
使用普通的 let:
nabi
let n = 3;
println(f"{n}");
3
相关错误码:E0065 锁守卫没有由 using 释放,E0092 直接调用 Drop::drop
发现错误? 在 GitHub 上编辑此页 最后更新: