#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 上編輯此頁 最後更新: