about summary refs log tree commit diff
path: root/tests/ui/self/move-self.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/self/move-self.rs')
-rw-r--r--tests/ui/self/move-self.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/self/move-self.rs b/tests/ui/self/move-self.rs
new file mode 100644
index 00000000000..66032780b81
--- /dev/null
+++ b/tests/ui/self/move-self.rs
@@ -0,0 +1,19 @@
+// run-pass
+struct S {
+    x: String
+}
+
+impl S {
+    pub fn foo(self) {
+        self.bar();
+    }
+
+    pub fn bar(self) {
+        println!("{}", self.x);
+    }
+}
+
+pub fn main() {
+    let x = S { x: "Hello!".to_string() };
+    x.foo();
+}