This repository has been archived by the owner on May 4, 2024. It is now read-only.
Compiler Doesn't Understand vector<T> where T doesn't have drop #1025
Labels
enhancement
New feature or request
The following code is correct, but fails to compile:
The compiler gives the incorrect error:
The problem is that K and V do not have drop, but the code above guarantees that vector and vector will both be empty by the end of execution, and hence both vectors will be dropable. The compiler incorrectly thinks that vector or vector may have values that we're dropping, but this is not the case.
I even added the assertions at the end, which didn't help.
The only real solution here is to add an unnecessary 'drop' requirement to K and V.
This limits Move overall; suppose I want to provide a vector of objects that do not have
drop
as an ability; Move essentially breaks and cannot handle this situation.The text was updated successfully, but these errors were encountered: