summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs')
-rw-r--r--tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs b/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs
new file mode 100644
index 000000000..6b5544a8a
--- /dev/null
+++ b/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs
@@ -0,0 +1,14 @@
+struct A;
+
+impl A {
+ fn foo(&mut self) {
+ }
+}
+
+
+
+pub fn main() {
+ let a: Box<_> = Box::new(A);
+ a.foo();
+ //~^ ERROR cannot borrow `*a` as mutable, as `a` is not declared as mutable [E0596]
+}