2014-11-05 17:05:01 -06:00
|
|
|
// Copyright 2014 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 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
struct Mine{
|
|
|
|
test: String,
|
2015-01-08 04:54:35 -06:00
|
|
|
other_val: isize
|
2014-11-05 17:05:01 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Mine{
|
|
|
|
fn make_string_bar(mut self) -> Mine{
|
|
|
|
self.test = "Bar".to_string();
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main(){
|
|
|
|
let start = Mine{test:"Foo".to_string(), other_val:0};
|
|
|
|
let end = Mine{other_val:1, ..start.make_string_bar()};
|
|
|
|
println!("{}", start.test); //~ ERROR use of moved value: `start.test`
|
|
|
|
}
|