Skip to content

Commit 3ba8404

Browse files
committed
Oops, hide 'unless once fn' error message hint behind -Z once-fns too.
1 parent 643be38 commit 3ba8404

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/librustc/middle/borrowck/gather_loans/gather_moves.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,14 @@ fn check_is_legal_to_move_from(bccx: @BorrowckCtxt,
115115
// These are separate from the above cases for a better error message.
116116
mc::cat_stack_upvar(*) |
117117
mc::cat_copied_upvar(mc::CopiedUpvar { onceness: ast::Many, _ }) => {
118+
let once_hint = if bccx.tcx.sess.once_fns() {
119+
" (unless the destination closure type is `once fn')"
120+
} else {
121+
""
122+
};
118123
bccx.span_err(
119124
cmt0.span,
120-
fmt!("cannot move out of %s \
121-
(unless the destination closure type is `once fn')",
122-
bccx.cmt_to_str(cmt)));
125+
fmt!("cannot move out of %s%s", bccx.cmt_to_str(cmt), once_hint));
123126
false
124127
}
125128

0 commit comments

Comments
 (0)