[rust-dev] CSV implementation

Marijn Haverbeke marijnh at gmail.com
Tue Jan 10 10:09:03 PST 2012

> I can understand the need for an implicit copy when I pass 'x' to
> str::from_chars. However, in the 'inquote' alt branch the copy seems to be
> triggered by the access to 'st.quote'.

This has to do with the reference safety checker. As soon as you refer
to `st` again the checker can no longer guarantee that the `x`
reference, which points at a mutable field of `st`, is still live. If
you flip the statements around so that `x` is not used after `st`, the
warning (and the copy) will go away.

More information about the Rust-dev mailing list