@@ -603,11 +603,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
603
603
604
604
let ( ol, moved_lp_msg) = match the_move. kind {
605
605
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
+
611
612
( self . loan_path_to_string ( moved_lp) ,
612
613
String :: new ( ) )
613
614
}
@@ -644,12 +645,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
644
645
let msg = if !has_fork && partial { "partially " }
645
646
else if has_fork && !has_common { "collaterally " }
646
647
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) ;
653
652
( ol, moved_lp_msg)
654
653
}
655
654
} ;
@@ -762,23 +761,21 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
762
761
& self ,
763
762
span : Span ,
764
763
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) ) ;
771
768
}
772
769
773
770
pub fn report_reassigned_immutable_variable ( & self ,
774
771
span : Span ,
775
772
lp : & LoanPath < ' tcx > ,
776
773
assign :
777
774
& 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) ) ;
782
779
self . tcx . sess . span_note ( assign. span , "prior assignment occurs here" ) ;
783
780
}
784
781
@@ -896,21 +893,19 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
896
893
897
894
match cause {
898
895
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) ;
903
899
}
904
900
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) ;
909
904
}
910
905
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) ;
914
909
if let BorrowViolation ( euv:: ClosureCapture ( _) ) = kind {
915
910
// The aliasability violation with closure captures can
916
911
// happen for nested closures, so we know the enclosing
@@ -925,14 +920,14 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
925
920
}
926
921
mc:: AliasableStatic ( ..) |
927
922
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) ;
931
926
}
932
927
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) ;
936
931
}
937
932
}
938
933
0 commit comments