@@ -11,7 +11,7 @@ use rustc::mir::interpret::{
1111} ;
1212
1313use super :: {
14- OpTy , Machine , EvalContext , ValueVisitor ,
14+ OpTy , Machine , EvalContext , ValueVisitor , MPlaceTy ,
1515} ;
1616
1717macro_rules! validation_failure {
@@ -74,13 +74,13 @@ pub enum PathElem {
7474}
7575
7676/// State for tracking recursive validation of references
77- pub struct RefTracking < ' tcx , Tag > {
78- pub seen : FxHashSet < ( OpTy < ' tcx , Tag > ) > ,
79- pub todo : Vec < ( OpTy < ' tcx , Tag > , Vec < PathElem > ) > ,
77+ pub struct RefTracking < T > {
78+ pub seen : FxHashSet < T > ,
79+ pub todo : Vec < ( T , Vec < PathElem > ) > ,
8080}
8181
82- impl < ' tcx , Tag : Copy + Eq + Hash > RefTracking < ' tcx , Tag > {
83- pub fn new ( op : OpTy < ' tcx , Tag > ) -> Self {
82+ impl < ' tcx , T : Copy + Eq + Hash > RefTracking < T > {
83+ pub fn new ( op : T ) -> Self {
8484 let mut ref_tracking = RefTracking {
8585 seen : FxHashSet :: default ( ) ,
8686 todo : vec ! [ ( op, Vec :: new( ) ) ] ,
@@ -151,7 +151,7 @@ struct ValidityVisitor<'rt, 'a: 'rt, 'mir: 'rt, 'tcx: 'a+'rt+'mir, M: Machine<'a
151151 /// starts must not be changed! `visit_fields` and `visit_array` rely on
152152 /// this stack discipline.
153153 path : Vec < PathElem > ,
154- ref_tracking : Option < & ' rt mut RefTracking < ' tcx , M :: PointerTag > > ,
154+ ref_tracking : Option < & ' rt mut RefTracking < MPlaceTy < ' tcx , M :: PointerTag > > > ,
155155 const_mode : bool ,
156156 ecx : & ' rt EvalContext < ' a , ' mir , ' tcx , M > ,
157157}
@@ -399,16 +399,15 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>
399399 // before. Proceed recursively even for integer pointers, no
400400 // reason to skip them! They are (recursively) valid for some ZST,
401401 // but not for others (e.g., `!` is a ZST).
402- let op = place. into ( ) ;
403- if ref_tracking. seen . insert ( op) {
404- trace ! ( "Recursing below ptr {:#?}" , * op) ;
402+ if ref_tracking. seen . insert ( place) {
403+ trace ! ( "Recursing below ptr {:#?}" , * place) ;
405404 // We need to clone the path anyway, make sure it gets created
406405 // with enough space for the additional `Deref`.
407406 let mut new_path = Vec :: with_capacity ( self . path . len ( ) +1 ) ;
408407 new_path. clone_from ( & self . path ) ;
409408 new_path. push ( PathElem :: Deref ) ;
410409 // Remember to come back to this later.
411- ref_tracking. todo . push ( ( op , new_path) ) ;
410+ ref_tracking. todo . push ( ( place , new_path) ) ;
412411 }
413412 }
414413 }
@@ -598,7 +597,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
598597 & self ,
599598 op : OpTy < ' tcx , M :: PointerTag > ,
600599 path : Vec < PathElem > ,
601- ref_tracking : Option < & mut RefTracking < ' tcx , M :: PointerTag > > ,
600+ ref_tracking : Option < & mut RefTracking < MPlaceTy < ' tcx , M :: PointerTag > > > ,
602601 const_mode : bool ,
603602 ) -> EvalResult < ' tcx > {
604603 trace ! ( "validate_operand: {:?}, {:?}" , * op, op. layout. ty) ;
0 commit comments