3 ms·
Because the calling function isn't using it at the time. Rust isn't proving something about the number of references in memory; it's proving something about the
by Filligree 4y ago
Because the calling function isn't using it at the time. Rust isn't proving something about the number of references in memory; it's proving something about the dynamic behaviour of the program, i.e. that there can be at most one reference actively being used to mutate it, at a time.
Hence there's no problem cloning a mutable reference implicitly, when calling a function. Notice that you can't for instance send it to another thread, however.