diff options
Diffstat (limited to 'src/test/ui/self/move-self.rs')
-rw-r--r-- | src/test/ui/self/move-self.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/self/move-self.rs b/src/test/ui/self/move-self.rs new file mode 100644 index 000000000..66032780b --- /dev/null +++ b/src/test/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(); +} |