@@ -81,7 +81,7 @@ impl Drop for SpanGuard {
8181}
8282
8383/// A stack frame.
84- pub struct Frame < ' mir , ' tcx , Tag : Provenance = AllocId , Extra = ( ) > {
84+ pub struct Frame < ' mir , ' tcx , Prov : Provenance = AllocId , Extra = ( ) > {
8585 ////////////////////////////////////////////////////////////////////////////////
8686 // Function and callsite information
8787 ////////////////////////////////////////////////////////////////////////////////
@@ -102,7 +102,7 @@ pub struct Frame<'mir, 'tcx, Tag: Provenance = AllocId, Extra = ()> {
102102
103103 /// The location where the result of the current stack frame should be written to,
104104 /// and its layout in the caller.
105- pub return_place : PlaceTy < ' tcx , Tag > ,
105+ pub return_place : PlaceTy < ' tcx , Prov > ,
106106
107107 /// The list of locals for this stack frame, stored in order as
108108 /// `[return_ptr, arguments..., variables..., temporaries...]`.
@@ -111,7 +111,7 @@ pub struct Frame<'mir, 'tcx, Tag: Provenance = AllocId, Extra = ()> {
111111 /// can either directly contain `Scalar` or refer to some part of an `Allocation`.
112112 ///
113113 /// Do *not* access this directly; always go through the machine hook!
114- pub locals : IndexVec < mir:: Local , LocalState < ' tcx , Tag > > ,
114+ pub locals : IndexVec < mir:: Local , LocalState < ' tcx , Prov > > ,
115115
116116 /// The span of the `tracing` crate is stored here.
117117 /// When the guard is dropped, the span is exited. This gives us
@@ -166,32 +166,32 @@ pub enum StackPopCleanup {
166166
167167/// State of a local variable including a memoized layout
168168#[ derive( Clone , Debug ) ]
169- pub struct LocalState < ' tcx , Tag : Provenance = AllocId > {
170- pub value : LocalValue < Tag > ,
169+ pub struct LocalState < ' tcx , Prov : Provenance = AllocId > {
170+ pub value : LocalValue < Prov > ,
171171 /// Don't modify if `Some`, this is only used to prevent computing the layout twice
172172 pub layout : Cell < Option < TyAndLayout < ' tcx > > > ,
173173}
174174
175175/// Current value of a local variable
176176#[ derive( Copy , Clone , Debug ) ] // Miri debug-prints these
177- pub enum LocalValue < Tag : Provenance = AllocId > {
177+ pub enum LocalValue < Prov : Provenance = AllocId > {
178178 /// This local is not currently alive, and cannot be used at all.
179179 Dead ,
180180 /// A normal, live local.
181181 /// Mostly for convenience, we re-use the `Operand` type here.
182182 /// This is an optimization over just always having a pointer here;
183183 /// we can thus avoid doing an allocation when the local just stores
184184 /// immediate values *and* never has its address taken.
185- Live ( Operand < Tag > ) ,
185+ Live ( Operand < Prov > ) ,
186186}
187187
188- impl < ' tcx , Tag : Provenance + ' static > LocalState < ' tcx , Tag > {
188+ impl < ' tcx , Prov : Provenance + ' static > LocalState < ' tcx , Prov > {
189189 /// Read the local's value or error if the local is not yet live or not live anymore.
190190 ///
191191 /// Note: This may only be invoked from the `Machine::access_local` hook and not from
192192 /// anywhere else. You may be invalidating machine invariants if you do!
193193 #[ inline]
194- pub fn access ( & self ) -> InterpResult < ' tcx , & Operand < Tag > > {
194+ pub fn access ( & self ) -> InterpResult < ' tcx , & Operand < Prov > > {
195195 match & self . value {
196196 LocalValue :: Dead => throw_ub ! ( DeadLocal ) , // could even be "invalid program"?
197197 LocalValue :: Live ( val) => Ok ( val) ,
@@ -204,16 +204,16 @@ impl<'tcx, Tag: Provenance + 'static> LocalState<'tcx, Tag> {
204204 /// Note: This may only be invoked from the `Machine::access_local_mut` hook and not from
205205 /// anywhere else. You may be invalidating machine invariants if you do!
206206 #[ inline]
207- pub fn access_mut ( & mut self ) -> InterpResult < ' tcx , & mut Operand < Tag > > {
207+ pub fn access_mut ( & mut self ) -> InterpResult < ' tcx , & mut Operand < Prov > > {
208208 match & mut self . value {
209209 LocalValue :: Dead => throw_ub ! ( DeadLocal ) , // could even be "invalid program"?
210210 LocalValue :: Live ( val) => Ok ( val) ,
211211 }
212212 }
213213}
214214
215- impl < ' mir , ' tcx , Tag : Provenance > Frame < ' mir , ' tcx , Tag > {
216- pub fn with_extra < Extra > ( self , extra : Extra ) -> Frame < ' mir , ' tcx , Tag , Extra > {
215+ impl < ' mir , ' tcx , Prov : Provenance > Frame < ' mir , ' tcx , Prov > {
216+ pub fn with_extra < Extra > ( self , extra : Extra ) -> Frame < ' mir , ' tcx , Prov , Extra > {
217217 Frame {
218218 body : self . body ,
219219 instance : self . instance ,
@@ -227,7 +227,7 @@ impl<'mir, 'tcx, Tag: Provenance> Frame<'mir, 'tcx, Tag> {
227227 }
228228}
229229
230- impl < ' mir , ' tcx , Tag : Provenance , Extra > Frame < ' mir , ' tcx , Tag , Extra > {
230+ impl < ' mir , ' tcx , Prov : Provenance , Extra > Frame < ' mir , ' tcx , Prov , Extra > {
231231 /// Get the current location within the Frame.
232232 ///
233233 /// If this is `Err`, we are not currently executing any particular statement in
@@ -422,14 +422,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
422422 }
423423
424424 #[ inline( always) ]
425- pub ( crate ) fn stack ( & self ) -> & [ Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > ] {
425+ pub ( crate ) fn stack ( & self ) -> & [ Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > ] {
426426 M :: stack ( self )
427427 }
428428
429429 #[ inline( always) ]
430430 pub ( crate ) fn stack_mut (
431431 & mut self ,
432- ) -> & mut Vec < Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > > {
432+ ) -> & mut Vec < Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > > {
433433 M :: stack_mut ( self )
434434 }
435435
@@ -441,12 +441,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
441441 }
442442
443443 #[ inline( always) ]
444- pub fn frame ( & self ) -> & Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > {
444+ pub fn frame ( & self ) -> & Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > {
445445 self . stack ( ) . last ( ) . expect ( "no call frames exist" )
446446 }
447447
448448 #[ inline( always) ]
449- pub fn frame_mut ( & mut self ) -> & mut Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > {
449+ pub fn frame_mut ( & mut self ) -> & mut Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > {
450450 self . stack_mut ( ) . last_mut ( ) . expect ( "no call frames exist" )
451451 }
452452
@@ -503,7 +503,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
503503 /// stack frame), to bring it into the proper environment for this interpreter.
504504 pub ( super ) fn subst_from_frame_and_normalize_erasing_regions < T : TypeFoldable < ' tcx > > (
505505 & self ,
506- frame : & Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > ,
506+ frame : & Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > ,
507507 value : T ,
508508 ) -> Result < T , InterpError < ' tcx > > {
509509 frame
@@ -540,7 +540,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
540540 #[ inline( always) ]
541541 pub fn layout_of_local (
542542 & self ,
543- frame : & Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > ,
543+ frame : & Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > ,
544544 local : mir:: Local ,
545545 layout : Option < TyAndLayout < ' tcx > > ,
546546 ) -> InterpResult < ' tcx , TyAndLayout < ' tcx > > {
@@ -569,7 +569,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
569569 /// This can fail to provide an answer for extern types.
570570 pub ( super ) fn size_and_align_of (
571571 & self ,
572- metadata : & MemPlaceMeta < M :: PointerTag > ,
572+ metadata : & MemPlaceMeta < M :: Provenance > ,
573573 layout : & TyAndLayout < ' tcx > ,
574574 ) -> InterpResult < ' tcx , Option < ( Size , Align ) > > {
575575 if !layout. is_unsized ( ) {
@@ -655,7 +655,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
655655 #[ inline]
656656 pub fn size_and_align_of_mplace (
657657 & self ,
658- mplace : & MPlaceTy < ' tcx , M :: PointerTag > ,
658+ mplace : & MPlaceTy < ' tcx , M :: Provenance > ,
659659 ) -> InterpResult < ' tcx , Option < ( Size , Align ) > > {
660660 self . size_and_align_of ( & mplace. meta , & mplace. layout )
661661 }
@@ -665,7 +665,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
665665 & mut self ,
666666 instance : ty:: Instance < ' tcx > ,
667667 body : & ' mir mir:: Body < ' tcx > ,
668- return_place : & PlaceTy < ' tcx , M :: PointerTag > ,
668+ return_place : & PlaceTy < ' tcx , M :: Provenance > ,
669669 return_to_block : StackPopCleanup ,
670670 ) -> InterpResult < ' tcx > {
671671 trace ! ( "body: {:#?}" , body) ;
@@ -891,7 +891,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
891891 }
892892
893893 #[ instrument( skip( self ) , level = "debug" ) ]
894- fn deallocate_local ( & mut self , local : LocalValue < M :: PointerTag > ) -> InterpResult < ' tcx > {
894+ fn deallocate_local ( & mut self , local : LocalValue < M :: Provenance > ) -> InterpResult < ' tcx > {
895895 if let LocalValue :: Live ( Operand :: Indirect ( MemPlace { ptr, .. } ) ) = local {
896896 // All locals have a backing allocation, even if the allocation is empty
897897 // due to the local having ZST type. Hence we can `unwrap`.
@@ -909,7 +909,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
909909 pub fn eval_to_allocation (
910910 & self ,
911911 gid : GlobalId < ' tcx > ,
912- ) -> InterpResult < ' tcx , MPlaceTy < ' tcx , M :: PointerTag > > {
912+ ) -> InterpResult < ' tcx , MPlaceTy < ' tcx , M :: Provenance > > {
913913 // For statics we pick `ParamEnv::reveal_all`, because statics don't have generics
914914 // and thus don't care about the parameter environment. While we could just use
915915 // `self.param_env`, that would mean we invoke the query to evaluate the static
@@ -927,7 +927,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
927927 }
928928
929929 #[ must_use]
930- pub fn dump_place ( & self , place : Place < M :: PointerTag > ) -> PlacePrinter < ' _ , ' mir , ' tcx , M > {
930+ pub fn dump_place ( & self , place : Place < M :: Provenance > ) -> PlacePrinter < ' _ , ' mir , ' tcx , M > {
931931 PlacePrinter { ecx : self , place }
932932 }
933933
@@ -956,7 +956,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
956956/// Helper struct for the `dump_place` function.
957957pub struct PlacePrinter < ' a , ' mir , ' tcx , M : Machine < ' mir , ' tcx > > {
958958 ecx : & ' a InterpCx < ' mir , ' tcx , M > ,
959- place : Place < M :: PointerTag > ,
959+ place : Place < M :: Provenance > ,
960960}
961961
962962impl < ' a , ' mir , ' tcx : ' mir , M : Machine < ' mir , ' tcx > > std:: fmt:: Debug
0 commit comments