@@ -696,7 +696,7 @@ pub struct LocalDecl<'tcx> {
696696 pub mutability : Mutability ,
697697
698698 // FIXME(matthewjasper) Don't store in this in `Body`
699- pub local_info : LocalInfo < ' tcx > ,
699+ pub local_info : Option < Box < LocalInfo < ' tcx > > > ,
700700
701701 /// `true` if this is an internal local.
702702 ///
@@ -818,9 +818,11 @@ pub struct LocalDecl<'tcx> {
818818
819819// `LocalDecl` is used a lot. Make sure it doesn't unintentionally get bigger.
820820#[ cfg( target_arch = "x86_64" ) ]
821- static_assert_size ! ( LocalDecl <' _>, 128 ) ;
821+ static_assert_size ! ( LocalDecl <' _>, 72 ) ;
822822
823- /// Extra information about a local that's used for diagnostics.
823+ /// Extra information about a some locals that's used for diagnostics. (Not
824+ /// used for non-StaticRef temporaries, the return place, or anonymous function
825+ /// parameters.)
824826#[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable , TypeFoldable ) ]
825827pub enum LocalInfo < ' tcx > {
826828 /// A user-defined local variable or function parameter
@@ -831,8 +833,6 @@ pub enum LocalInfo<'tcx> {
831833 User ( ClearCrossCrate < BindingForm < ' tcx > > ) ,
832834 /// A temporary created that references the static with the given `DefId`.
833835 StaticRef { def_id : DefId , is_thread_local : bool } ,
834- /// Any other temporary, the return place, or an anonymous function parameter.
835- Other ,
836836}
837837
838838impl < ' tcx > LocalDecl < ' tcx > {
@@ -844,16 +844,16 @@ impl<'tcx> LocalDecl<'tcx> {
844844 /// - or `match ... { C(x) => ... }`
845845 pub fn can_be_made_mutable ( & self ) -> bool {
846846 match self . local_info {
847- LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: Var ( VarBindingForm {
847+ Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: Var ( VarBindingForm {
848848 binding_mode : ty:: BindingMode :: BindByValue ( _) ,
849849 opt_ty_info : _,
850850 opt_match_place : _,
851851 pat_span : _,
852- } ) ) ) => true ,
852+ } ) ) ) ) => true ,
853853
854- LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: ImplicitSelf (
854+ Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: ImplicitSelf (
855855 ImplicitSelfKind :: Imm ,
856- ) ) ) => true ,
856+ ) ) ) ) => true ,
857857
858858 _ => false ,
859859 }
@@ -864,14 +864,14 @@ impl<'tcx> LocalDecl<'tcx> {
864864 /// mutable bindings, but the inverse does not necessarily hold).
865865 pub fn is_nonref_binding ( & self ) -> bool {
866866 match self . local_info {
867- LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: Var ( VarBindingForm {
867+ Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: Var ( VarBindingForm {
868868 binding_mode : ty:: BindingMode :: BindByValue ( _) ,
869869 opt_ty_info : _,
870870 opt_match_place : _,
871871 pat_span : _,
872- } ) ) ) => true ,
872+ } ) ) ) ) => true ,
873873
874- LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: ImplicitSelf ( _) ) ) => true ,
874+ Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: ImplicitSelf ( _) ) ) ) => true ,
875875
876876 _ => false ,
877877 }
@@ -882,7 +882,7 @@ impl<'tcx> LocalDecl<'tcx> {
882882 #[ inline]
883883 pub fn is_user_variable ( & self ) -> bool {
884884 match self . local_info {
885- LocalInfo :: User ( _) => true ,
885+ Some ( box LocalInfo :: User ( _) ) => true ,
886886 _ => false ,
887887 }
888888 }
@@ -892,7 +892,7 @@ impl<'tcx> LocalDecl<'tcx> {
892892 /// match arm.
893893 pub fn is_ref_for_guard ( & self ) -> bool {
894894 match self . local_info {
895- LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: RefForGuard ) ) => true ,
895+ Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: RefForGuard ) ) ) => true ,
896896 _ => false ,
897897 }
898898 }
@@ -901,7 +901,7 @@ impl<'tcx> LocalDecl<'tcx> {
901901 /// access that static
902902 pub fn is_ref_to_static ( & self ) -> bool {
903903 match self . local_info {
904- LocalInfo :: StaticRef { .. } => true ,
904+ Some ( box LocalInfo :: StaticRef { .. } ) => true ,
905905 _ => false ,
906906 }
907907 }
@@ -910,7 +910,7 @@ impl<'tcx> LocalDecl<'tcx> {
910910 /// access that static
911911 pub fn is_ref_to_thread_local ( & self ) -> bool {
912912 match self . local_info {
913- LocalInfo :: StaticRef { is_thread_local, .. } => is_thread_local,
913+ Some ( box LocalInfo :: StaticRef { is_thread_local, .. } ) => is_thread_local,
914914 _ => false ,
915915 }
916916 }
@@ -933,7 +933,7 @@ impl<'tcx> LocalDecl<'tcx> {
933933 pub fn with_source_info ( ty : Ty < ' tcx > , source_info : SourceInfo ) -> Self {
934934 LocalDecl {
935935 mutability : Mutability :: Mut ,
936- local_info : LocalInfo :: Other ,
936+ local_info : None ,
937937 internal : false ,
938938 is_block_tail : None ,
939939 ty,
0 commit comments