]> git.lizzy.rs Git - rust.git/blob - tests/ui/moves/move-out-of-field.rs
fn-trait-closure test now pass on new solver
[rust.git] / tests / ui / moves / move-out-of-field.rs
1 // run-pass
2
3 use std::string::String;
4
5 struct StringBuffer {
6     s: String,
7 }
8
9 impl StringBuffer {
10     pub fn append(&mut self, v: &str) {
11         self.s.push_str(v);
12     }
13 }
14
15 fn to_string(sb: StringBuffer) -> String {
16     sb.s
17 }
18
19 pub fn main() {
20     let mut sb = StringBuffer {
21         s: String::new(),
22     };
23     sb.append("Hello, ");
24     sb.append("World!");
25     let str = to_string(sb);
26     assert_eq!(str, "Hello, World!");
27 }