On Tue, Mar 12, 2013 at 01:07:07PM -0400, Jack Lloyd wrote:
> If two or more struct initializers have side effects, is the order
> that they run defined?
I'm pretty sure it is, because it's actually part of the type system.
See src/test/run-pass/struct-order-of-eval-2.rs:
struct S { f0: ~str, f
There is code in the compiler explicitly making sure initializers run
in source order, and I expect it will stay that way. So I guess this
should be mentioned in the documentation as being something you can
rely on.
Best,
Marijn
___
Rust-dev mailing list
If two or more struct initializers have side effects, is the order
that they run defined? Testing with the code below and Rust 0.5 seems
to show that the order of evaluation is the order that the
initialization occurs in (eg swapping the order of len and val in
packet_read causes get_u16 to be call