From 3ba8404c88972f2324ce97fa7e5a433399d946ed Mon Sep 17 00:00:00 2001 From: Ben Blum Date: Wed, 19 Jun 2013 16:03:31 -0400 Subject: [PATCH] Oops, hide 'unless once fn' error message hint behind -Z once-fns too. --- .../middle/borrowck/gather_loans/gather_moves.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs index d982be684a2d..b28b056e22b3 100644 --- a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs @@ -115,11 +115,14 @@ fn check_is_legal_to_move_from(bccx: @BorrowckCtxt, // These are separate from the above cases for a better error message. mc::cat_stack_upvar(*) | mc::cat_copied_upvar(mc::CopiedUpvar { onceness: ast::Many, _ }) => { + let once_hint = if bccx.tcx.sess.once_fns() { + " (unless the destination closure type is `once fn')" + } else { + "" + }; bccx.span_err( cmt0.span, - fmt!("cannot move out of %s \ - (unless the destination closure type is `once fn')", - bccx.cmt_to_str(cmt))); + fmt!("cannot move out of %s%s", bccx.cmt_to_str(cmt), once_hint)); false }