1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Forbid assignment into a dynamically sized type.
13 struct Fat<Sized? T> {
19 #[deriving(PartialEq,Eq)]
22 #[deriving(PartialEq,Eq)]
28 fn to_bar(&self) -> Bar;
29 fn to_val(&self) -> int;
33 fn to_bar(&self) -> Bar {
36 fn to_val(&self) -> int {
43 let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} };
44 let z: Box<ToBar> = box Bar1 {f: 36};
45 f5.ptr = *z; //~ ERROR dynamically sized type on lhs of assignment