You are right, my code does not work because println uses a dropped vec. Sorry about that, I should have tested it before posting.
I don’t think it can be fixed, but it should be possible to write a macro, something like
with_mut! vec {
vec.push(1);
vec.push(2);
}
(Not sure whether this syntax is possible with the current macro rules though.)
I would really like to write let mut (a, b, c) instead of let (mut a, mut b, mut c).