Skip to content

Commit 9406f81

Browse files
committed
Avoid repeating 'try adding a move' hint
1 parent f1e5b36 commit 9406f81

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/rustc/middle/kind.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ use lint::{non_implicitly_copyable_typarams,implicit_copies};
3838
// primitives in the stdlib are explicitly annotated to only take sendable
3939
// types.
4040

41+
const try_adding: &str = "Try adding a move";
42+
4143
fn kind_to_str(k: kind) -> ~str {
4244
let mut kinds = ~[];
4345

@@ -217,7 +219,7 @@ fn check_block(b: blk, cx: ctx, v: visit::vt<ctx>) {
217219
match b.node.expr {
218220
Some(ex) => maybe_copy(cx, ex,
219221
Some(("Tail expressions in blocks must be copyable",
220-
"Try adding a move"))),
222+
try_adding))),
221223
_ => ()
222224
}
223225
visit::visit_block(b, cx, v);
@@ -279,11 +281,11 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
279281
expr_unary(box(_), ex) | expr_unary(uniq(_), ex) |
280282
expr_ret(Some(ex)) => {
281283
maybe_copy(cx, ex, Some(("Returned values must be copyable",
282-
"Try adding a move")));
284+
try_adding)));
283285
}
284286
expr_cast(source, _) => {
285287
maybe_copy(cx, source, Some(("Casted values must be copyable",
286-
"Try adding a move")));
288+
try_adding)));
287289
check_cast_for_escaping_regions(cx, source, e);
288290
}
289291
expr_copy(expr) => check_copy_ex(cx, expr, false,

0 commit comments

Comments
 (0)