@@ -603,11 +603,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
603603
604604 let ( ol, moved_lp_msg) = match the_move. kind {
605605 move_data:: Declared => {
606- self . tcx . sess . span_err (
607- use_span,
608- & format ! ( "{} of possibly uninitialized variable: `{}`" ,
609- verb,
610- self . loan_path_to_string( lp) ) ) ;
606+ span_err ! (
607+ self . tcx. sess, use_span, E0381 ,
608+ "{} of possibly uninitialized variable: `{}`" ,
609+ verb,
610+ self . loan_path_to_string( lp) ) ;
611+
611612 ( self . loan_path_to_string ( moved_lp) ,
612613 String :: new ( ) )
613614 }
@@ -644,12 +645,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
644645 let msg = if !has_fork && partial { "partially " }
645646 else if has_fork && !has_common { "collaterally " }
646647 else { "" } ;
647- self . tcx . sess . span_err (
648- use_span,
649- & format ! ( "{} of {}moved value: `{}`" ,
650- verb,
651- msg,
652- nl) ) ;
648+ span_err ! (
649+ self . tcx. sess, use_span, E0382 ,
650+ "{} of {}moved value: `{}`" ,
651+ verb, msg, nl) ;
653652 ( ol, moved_lp_msg)
654653 }
655654 } ;
@@ -762,23 +761,21 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
762761 & self ,
763762 span : Span ,
764763 lp : & LoanPath < ' tcx > ) {
765- self . tcx
766- . sess
767- . span_err ( span,
768- & format ! ( "partial reinitialization of uninitialized \
769- structure `{}`",
770- self . loan_path_to_string( lp) ) ) ;
764+ span_err ! (
765+ self . tcx. sess, span, E0383 ,
766+ "partial reinitialization of uninitialized structure `{}`" ,
767+ self . loan_path_to_string( lp) ) ;
771768 }
772769
773770 pub fn report_reassigned_immutable_variable ( & self ,
774771 span : Span ,
775772 lp : & LoanPath < ' tcx > ,
776773 assign :
777774 & move_data:: Assignment ) {
778- self . tcx . sess . span_err (
779- span,
780- & format ! ( "re-assignment of immutable variable `{}`" ,
781- self . loan_path_to_string( lp) ) ) ;
775+ span_err ! (
776+ self . tcx . sess , span, E0384 ,
777+ "re-assignment of immutable variable `{}`" ,
778+ self . loan_path_to_string( lp) ) ;
782779 self . tcx . sess . span_note ( assign. span , "prior assignment occurs here" ) ;
783780 }
784781
@@ -896,21 +893,19 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
896893
897894 match cause {
898895 mc:: AliasableOther => {
899- self . tcx . sess . span_err (
900- span,
901- & format ! ( "{} in an aliasable location" ,
902- prefix) ) ;
896+ span_err ! (
897+ self . tcx. sess, span, E0385 ,
898+ "{} in an aliasable location" , prefix) ;
903899 }
904900 mc:: AliasableReason :: UnaliasableImmutable => {
905- self . tcx . sess . span_err (
906- span,
907- & format ! ( "{} in an immutable container" ,
908- prefix) ) ;
901+ span_err ! (
902+ self . tcx. sess, span, E0386 ,
903+ "{} in an immutable container" , prefix) ;
909904 }
910905 mc:: AliasableClosure ( id) => {
911- self . tcx . sess . span_err ( span ,
912- & format ! ( "{} in a captured outer \
913- variable in an `Fn` closure", prefix) ) ;
906+ span_err ! (
907+ self . tcx . sess , span , E0387 ,
908+ "{} in a captured outer variable in an `Fn` closure", prefix) ;
914909 if let BorrowViolation ( euv:: ClosureCapture ( _) ) = kind {
915910 // The aliasability violation with closure captures can
916911 // happen for nested closures, so we know the enclosing
@@ -925,14 +920,14 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
925920 }
926921 mc:: AliasableStatic ( ..) |
927922 mc:: AliasableStaticMut ( ..) => {
928- self . tcx . sess . span_err (
929- span,
930- & format ! ( "{} in a static location" , prefix) ) ;
923+ span_err ! (
924+ self . tcx . sess , span, E0388 ,
925+ "{} in a static location" , prefix) ;
931926 }
932927 mc:: AliasableBorrowed => {
933- self . tcx . sess . span_err (
934- span,
935- & format ! ( "{} in a `&` reference" , prefix) ) ;
928+ span_err ! (
929+ self . tcx . sess , span, E0389 ,
930+ "{} in a `&` reference" , prefix) ;
936931 }
937932 }
938933
0 commit comments