@@ -177,11 +177,10 @@ pub struct LocalState<'tcx, Tag: Provenance = AllocId> {
177177pub enum LocalValue < Tag : Provenance = AllocId > {
178178 /// This local is not currently alive, and cannot be used at all.
179179 Dead ,
180- /// This local is alive but not yet initialized. It can be written to
181- /// but not read from or its address taken. Locals get initialized on
182- /// first write because for unsized locals, we do not know their size
183- /// before that.
184- Uninitialized ,
180+ /// This local is alive but not yet allocated. It cannot be read from or have its address taken,
181+ /// and will be allocated on the first write. This is to support unsized locals, where we cannot
182+ /// know their size in advance.
183+ Unallocated ,
185184 /// A normal, live local.
186185 /// Mostly for convenience, we re-use the `Operand` type here.
187186 /// This is an optimization over just always having a pointer here;
@@ -198,7 +197,7 @@ impl<'tcx, Tag: Provenance + 'static> LocalState<'tcx, Tag> {
198197 pub fn access ( & self ) -> InterpResult < ' tcx , Operand < Tag > > {
199198 match self . value {
200199 LocalValue :: Dead => throw_ub ! ( DeadLocal ) ,
201- LocalValue :: Uninitialized => {
200+ LocalValue :: Unallocated => {
202201 bug ! ( "The type checker should prevent reading from a never-written local" )
203202 }
204203 LocalValue :: Live ( val) => Ok ( val) ,
@@ -216,8 +215,7 @@ impl<'tcx, Tag: Provenance + 'static> LocalState<'tcx, Tag> {
216215 match self . value {
217216 LocalValue :: Dead => throw_ub ! ( DeadLocal ) ,
218217 LocalValue :: Live ( Operand :: Indirect ( mplace) ) => Ok ( Err ( mplace) ) ,
219- ref mut
220- local @ ( LocalValue :: Live ( Operand :: Immediate ( _) ) | LocalValue :: Uninitialized ) => {
218+ ref mut local @ ( LocalValue :: Live ( Operand :: Immediate ( _) ) | LocalValue :: Unallocated ) => {
221219 Ok ( Ok ( local) )
222220 }
223221 }
@@ -752,8 +750,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
752750 } ) ?;
753751 }
754752
755- // Locals are initially uninitialized .
756- let dummy = LocalState { value : LocalValue :: Uninitialized , layout : Cell :: new ( None ) } ;
753+ // Locals are initially unallocated .
754+ let dummy = LocalState { value : LocalValue :: Unallocated , layout : Cell :: new ( None ) } ;
757755 let mut locals = IndexVec :: from_elem ( dummy, & body. local_decls ) ;
758756
759757 // Now mark those locals as dead that we do not want to initialize
@@ -921,7 +919,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
921919 assert ! ( local != mir:: RETURN_PLACE , "Cannot make return place live" ) ;
922920 trace ! ( "{:?} is now live" , local) ;
923921
924- let local_val = LocalValue :: Uninitialized ;
922+ let local_val = LocalValue :: Unallocated ;
925923 // StorageLive expects the local to be dead, and marks it live.
926924 let old = mem:: replace ( & mut self . frame_mut ( ) . locals [ local] . value , local_val) ;
927925 if !matches ! ( old, LocalValue :: Dead ) {
@@ -1025,7 +1023,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> std::fmt::Debug
10251023
10261024 match self . ecx . stack ( ) [ frame] . locals [ local] . value {
10271025 LocalValue :: Dead => write ! ( fmt, " is dead" ) ?,
1028- LocalValue :: Uninitialized => write ! ( fmt, " is uninitialized " ) ?,
1026+ LocalValue :: Unallocated => write ! ( fmt, " is unallocated " ) ?,
10291027 LocalValue :: Live ( Operand :: Indirect ( mplace) ) => {
10301028 write ! (
10311029 fmt,
0 commit comments