diff --git a/src/test/run-pass/struct-order-of-eval-1.rs b/src/test/run-pass/struct-order-of-eval-1.rs new file mode 100644 index 000000000000..db7c73cbfc5e --- /dev/null +++ b/src/test/run-pass/struct-order-of-eval-1.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct S { f0: ~str, f1: int } + +pub fn main() { + let s = ~"Hello, world!"; + let _s = S { f0: str::from_slice(s), ..S { f0: s, f1: 23 } }; +} diff --git a/src/test/run-pass/struct-order-of-eval-2.rs b/src/test/run-pass/struct-order-of-eval-2.rs new file mode 100644 index 000000000000..413f185659a6 --- /dev/null +++ b/src/test/run-pass/struct-order-of-eval-2.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct S { f0: ~str, f1: ~str } + +pub fn main() { + let s = ~"Hello, world!"; + let _s = S { f1: str::from_slice(s), f0: s }; +}