I’m very happy rust-version in Cargo.toml is finally here.
Technically, Rust has dropped support for 1.55 today, just like they’ve been immediately dropping support for all previous versions. Rust has an “evergreen” update policy (like Chrome), which IMHO works very well, but it’s unusual among programming languages. Users who use their Linux distro’s inevitably outdated officially unsupported Rust packages get baffling compilation errors. From now on, at least they’ll get an explicit “your Rust is too old” error.
Disjoint captures is my favorite feature, that was a wishlist item for a lot of people for a long time. To be clear, it never stopped me from building anything, but it was a “this should really exist but I don’t want to be the one to work on it” item for me.
Possibly related: If the compiler can capture single struct fields, shouldn’t it be able to borrow single slice elements?
error[E0499]: cannot borrow `vec` as mutable more than once at a time
10 | take_three(&mut vec, &mut vec, &mut vec);
| ---------- --- --- ^^^ third mutable borrow occurs here
| | | |
| | | second mutable borrow occurs here
| | first mutable borrow occurs here
| first borrow later used by call
It is already possible to solve this, but rather manually: There is a function, slice::split_at_mut(), which partitions the slice in two. Not very ergonomic to have to use, especially for more than 2 elements.
In lack of a better word, I think “automatically split borrows” should also exist. When I read about disjoint captures, I had a hope they would have fixed this too, so I had to try (rustc 1.56, edition 2021), but apparently not.
Apparently there’s a large compile time regression related to 1.56.0: https://www.reddit.com/r/rust/comments/qdivb5/156_compile_time_is_through_the_roof/l