diff options
Diffstat (limited to 'tests/ui/borrowck/two-phase-method-receivers.rs')
-rw-r--r-- | tests/ui/borrowck/two-phase-method-receivers.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/borrowck/two-phase-method-receivers.rs b/tests/ui/borrowck/two-phase-method-receivers.rs new file mode 100644 index 000000000..6b879af5a --- /dev/null +++ b/tests/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); +} |