/src/test/compile-fail/record-with-resource.rs
Rust | 20 lines | 16 code | 3 blank | 1 comment | 0 complexity | e23c31450c4a9c68bf4568fb7b179911 MD5 | raw file
- // error-pattern: copying a noncopyable value
- struct my_resource {
- x: int,
- drop { log(error, self.x); }
- }
- fn my_resource(x: int) -> my_resource {
- my_resource {
- x: x
- }
- }
- fn main() {
- {
- let a = {x: 0, y: my_resource(20)};
- let b = {x: 2,.. a};
- log(error, (a, b));
- }
- }