Add test `const-cannot-move-shared-ref.rs`
diff --git a/tests/ui/borrowck/const-cannot-move-shared-ref.rs b/tests/ui/borrowck/const-cannot-move-shared-ref.rs
new file mode 100644
index 0000000..96a38a0
--- /dev/null
+++ b/tests/ui/borrowck/const-cannot-move-shared-ref.rs
@@ -0,0 +1,10 @@
+// Checks whether borrow checking visits constants correctly
+
+struct NonCopy(u8);
+
+const C: () = {
+    let &moved = &NonCopy(0);
+    //~^ ERROR cannot move out of a shared reference
+};
+
+fn main() { }
diff --git a/tests/ui/borrowck/const-cannot-move-shared-ref.stderr b/tests/ui/borrowck/const-cannot-move-shared-ref.stderr
new file mode 100644
index 0000000..2daac49
--- /dev/null
+++ b/tests/ui/borrowck/const-cannot-move-shared-ref.stderr
@@ -0,0 +1,17 @@
+error[E0507]: cannot move out of a shared reference
+  --> $DIR/const-cannot-move-shared-ref.rs:6:18
+   |
+LL |     let &moved = &NonCopy(0);
+   |          -----   ^^^^^^^^^^^
+   |          |
+   |          data moved here because `moved` has type `NonCopy`, which does not implement the `Copy` trait
+   |
+help: consider removing the borrow
+   |
+LL -     let &moved = &NonCopy(0);
+LL +     let moved = &NonCopy(0);
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0507`.