about summary refs log tree commit diff
path: root/tests/ui/error-codes/E0502.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/error-codes/E0502.rs')
-rw-r--r--tests/ui/error-codes/E0502.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/error-codes/E0502.rs b/tests/ui/error-codes/E0502.rs
new file mode 100644
index 00000000000..958380ece45
--- /dev/null
+++ b/tests/ui/error-codes/E0502.rs
@@ -0,0 +1,12 @@
+fn bar(x: &mut i32) {}
+fn foo(a: &mut i32) {
+    let ref y = a;
+    bar(a); //~ ERROR E0502
+    y.use_ref();
+}
+
+fn main() {
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { }  }
+impl<T> Fake for T { }