summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/two-phase-method-receivers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/borrowck/two-phase-method-receivers.rs')
-rw-r--r--src/test/ui/borrowck/two-phase-method-receivers.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/two-phase-method-receivers.rs b/src/test/ui/borrowck/two-phase-method-receivers.rs
new file mode 100644
index 000000000..6b879af5a
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-method-receivers.rs
@@ -0,0 +1,15 @@
+// run-pass
+
+struct Foo<'a> {
+ x: &'a i32
+}
+
+impl<'a> Foo<'a> {
+ fn method(&mut self, _: &i32) {
+ }
+}
+
+fn main() {
+ let a = &mut Foo { x: &22 };
+ Foo::method(a, a.x);
+}