@@ -705,12 +705,6 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
705705 } , " (into closure)" ) ,
706706 } ;
707707
708- let extra_move_label = if need_note {
709- format ! ( " because it has type `{}`, which does not implement the `Copy` trait" ,
710- moved_lp. ty)
711- } else {
712- String :: new ( )
713- } ;
714708 // Annotate the use and the move in the span. Watch out for
715709 // the case where the use and the move are the same. This
716710 // means the use is in a loop.
@@ -720,10 +714,22 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
720714 format ! ( "value moved{} here in previous iteration of loop{}" ,
721715 move_note,
722716 extra_move_label) ) ;
717+
718+ if need_note {
719+ err. note ( & format ! ( "value moved because it has type `{}`, \
720+ which does not implement the `Copy` trait",
721+ moved_lp. ty)
722+ }
723723 err
724724 } else {
725- err. span_label ( use_span, format ! ( "value {} here after move" , verb_participle) )
726- . span_label ( move_span, format ! ( "value moved{} here{}" , move_note, extra_move_label) ) ;
725+ err. span_label ( use_span, format ! ( "value {} here after move" , verb_participle) ) ;
726+ let extra_move_label = if need_note {
727+ & format ! ( " because it has type `{}`, which does not implement the `Copy` trait" ,
728+ moved_lp. ty)
729+ } else {
730+ ""
731+ } ;
732+ err. span_label ( move_span, format ! ( "value moved{} here{}" , move_note, extra_move_label) ) ;
727733 err
728734 } ;
729735
0 commit comments