@@ -696,7 +696,7 @@ pub struct LocalDecl<'tcx> {
696
696
pub mutability : Mutability ,
697
697
698
698
// FIXME(matthewjasper) Don't store in this in `Body`
699
- pub local_info : LocalInfo < ' tcx > ,
699
+ pub local_info : Option < Box < LocalInfo < ' tcx > > > ,
700
700
701
701
/// `true` if this is an internal local.
702
702
///
@@ -818,9 +818,11 @@ pub struct LocalDecl<'tcx> {
818
818
819
819
// `LocalDecl` is used a lot. Make sure it doesn't unintentionally get bigger.
820
820
#[ cfg( target_arch = "x86_64" ) ]
821
- static_assert_size ! ( LocalDecl <' _>, 128 ) ;
821
+ static_assert_size ! ( LocalDecl <' _>, 72 ) ;
822
822
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.)
824
826
#[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable , TypeFoldable ) ]
825
827
pub enum LocalInfo < ' tcx > {
826
828
/// A user-defined local variable or function parameter
@@ -831,8 +833,6 @@ pub enum LocalInfo<'tcx> {
831
833
User ( ClearCrossCrate < BindingForm < ' tcx > > ) ,
832
834
/// A temporary created that references the static with the given `DefId`.
833
835
StaticRef { def_id : DefId , is_thread_local : bool } ,
834
- /// Any other temporary, the return place, or an anonymous function parameter.
835
- Other ,
836
836
}
837
837
838
838
impl < ' tcx > LocalDecl < ' tcx > {
@@ -844,16 +844,16 @@ impl<'tcx> LocalDecl<'tcx> {
844
844
/// - or `match ... { C(x) => ... }`
845
845
pub fn can_be_made_mutable ( & self ) -> bool {
846
846
match self . local_info {
847
- LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: Var ( VarBindingForm {
847
+ Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: Var ( VarBindingForm {
848
848
binding_mode : ty:: BindingMode :: BindByValue ( _) ,
849
849
opt_ty_info : _,
850
850
opt_match_place : _,
851
851
pat_span : _,
852
- } ) ) ) => true ,
852
+ } ) ) ) ) => true ,
853
853
854
- LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: ImplicitSelf (
854
+ Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: ImplicitSelf (
855
855
ImplicitSelfKind :: Imm ,
856
- ) ) ) => true ,
856
+ ) ) ) ) => true ,
857
857
858
858
_ => false ,
859
859
}
@@ -864,14 +864,14 @@ impl<'tcx> LocalDecl<'tcx> {
864
864
/// mutable bindings, but the inverse does not necessarily hold).
865
865
pub fn is_nonref_binding ( & self ) -> bool {
866
866
match self . local_info {
867
- LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: Var ( VarBindingForm {
867
+ Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: Var ( VarBindingForm {
868
868
binding_mode : ty:: BindingMode :: BindByValue ( _) ,
869
869
opt_ty_info : _,
870
870
opt_match_place : _,
871
871
pat_span : _,
872
- } ) ) ) => true ,
872
+ } ) ) ) ) => true ,
873
873
874
- LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: ImplicitSelf ( _) ) ) => true ,
874
+ Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: ImplicitSelf ( _) ) ) ) => true ,
875
875
876
876
_ => false ,
877
877
}
@@ -882,7 +882,7 @@ impl<'tcx> LocalDecl<'tcx> {
882
882
#[ inline]
883
883
pub fn is_user_variable ( & self ) -> bool {
884
884
match self . local_info {
885
- LocalInfo :: User ( _) => true ,
885
+ Some ( box LocalInfo :: User ( _) ) => true ,
886
886
_ => false ,
887
887
}
888
888
}
@@ -892,7 +892,7 @@ impl<'tcx> LocalDecl<'tcx> {
892
892
/// match arm.
893
893
pub fn is_ref_for_guard ( & self ) -> bool {
894
894
match self . local_info {
895
- LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: RefForGuard ) ) => true ,
895
+ Some ( box LocalInfo :: User ( ClearCrossCrate :: Set ( BindingForm :: RefForGuard ) ) ) => true ,
896
896
_ => false ,
897
897
}
898
898
}
@@ -901,7 +901,7 @@ impl<'tcx> LocalDecl<'tcx> {
901
901
/// access that static
902
902
pub fn is_ref_to_static ( & self ) -> bool {
903
903
match self . local_info {
904
- LocalInfo :: StaticRef { .. } => true ,
904
+ Some ( box LocalInfo :: StaticRef { .. } ) => true ,
905
905
_ => false ,
906
906
}
907
907
}
@@ -910,7 +910,7 @@ impl<'tcx> LocalDecl<'tcx> {
910
910
/// access that static
911
911
pub fn is_ref_to_thread_local ( & self ) -> bool {
912
912
match self . local_info {
913
- LocalInfo :: StaticRef { is_thread_local, .. } => is_thread_local,
913
+ Some ( box LocalInfo :: StaticRef { is_thread_local, .. } ) => is_thread_local,
914
914
_ => false ,
915
915
}
916
916
}
@@ -933,7 +933,7 @@ impl<'tcx> LocalDecl<'tcx> {
933
933
pub fn with_source_info ( ty : Ty < ' tcx > , source_info : SourceInfo ) -> Self {
934
934
LocalDecl {
935
935
mutability : Mutability :: Mut ,
936
- local_info : LocalInfo :: Other ,
936
+ local_info : None ,
937
937
internal : false ,
938
938
is_block_tail : None ,
939
939
ty,
0 commit comments