Inconsistent mutable reference tracking in `vector` module.
metasim opened this issue · 0 comments
metasim commented
The following methods mutate the underlying C types but do not require a mutable reference in Rust.
LayerAccess::create_defn_fields
LayerAccess::set_feature
FieldDefn::set_width
FieldDefn::set_precision
Feature::set_field_string
Feature::set_field_string_list
Feature::set_field_double
Feature::set_field_double_list
Feature::set_field_integer
Feature::set_field_integer64
Feature::set_field_integer64_list
Feature::set_field_datetime
Feature::set_field
Also:
FieldDefn::add_to_layer
mutates thelayer
parameterFeature::create
mutateslyr
parameter
This means the following code compiles, but shouldn't under Rust ownership rules:
#[test]
fn multiple_mutable_references() {
let f = FieldDefn::new("foo", OGRFieldType::OFTInteger).unwrap();
let f1 = &f;
let f2 = &f;
f1.set_width(10);
f2.set_width(20);
}