about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-10-12 22:15:13 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-10-12 22:15:13 -0700
commit9406f8101dd32b4458b8c042a1bfb1bb150a2276 (patch)
treed201ee282a26ba61d30f0ddbe5e81b69e3bb14ac
parentf1e5b36ab25a6a6c64dac21868cb8f9550c87901 (diff)
downloadrust-9406f8101dd32b4458b8c042a1bfb1bb150a2276.tar.gz
rust-9406f8101dd32b4458b8c042a1bfb1bb150a2276.zip
Avoid repeating 'try adding a move' hint
-rw-r--r--src/rustc/middle/kind.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs
index b3ca3dc047d..36a05d66506 100644
--- a/src/rustc/middle/kind.rs
+++ b/src/rustc/middle/kind.rs
@@ -38,6 +38,8 @@ use lint::{non_implicitly_copyable_typarams,implicit_copies};
 // primitives in the stdlib are explicitly annotated to only take sendable
 // types.
 
+const try_adding: &str = "Try adding a move";
+
 fn kind_to_str(k: kind) -> ~str {
     let mut kinds = ~[];
 
@@ -217,7 +219,7 @@ fn check_block(b: blk, cx: ctx, v: visit::vt<ctx>) {
     match b.node.expr {
       Some(ex) => maybe_copy(cx, ex,
          Some(("Tail expressions in blocks must be copyable",
-                                   "Try adding a move"))),
+                                  try_adding))),
       _ => ()
     }
     visit::visit_block(b, cx, v);
@@ -279,11 +281,11 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
       expr_unary(box(_), ex) | expr_unary(uniq(_), ex) |
       expr_ret(Some(ex)) => {
         maybe_copy(cx, ex, Some(("Returned values must be copyable",
-                                 "Try adding a move")));
+                                 try_adding)));
       }
       expr_cast(source, _) => {
         maybe_copy(cx, source, Some(("Casted values must be copyable",
-                                     "Try adding a move")));
+                                     try_adding)));
         check_cast_for_escaping_regions(cx, source, e);
       }
       expr_copy(expr) => check_copy_ex(cx, expr, false,