@@ -4,12 +4,13 @@ use crate::component::matching::InstanceType;
44use crate :: component:: resources:: { HostResourceData , HostResourceIndex , HostResourceTables } ;
55use crate :: component:: { Instance , ResourceType } ;
66use crate :: prelude:: * ;
7- #[ cfg( all( feature = "rr" , feature = "rr-validate" ) ) ]
8- use crate :: rr:: Validate ;
97#[ cfg( feature = "rr-component" ) ]
10- use crate :: rr:: component_events:: { MemorySliceWriteEvent , ReallocEntryEvent , ReallocReturnEvent } ;
11- #[ cfg( feature = "rr-component" ) ]
12- use crate :: rr:: { RREvent , RecordBuffer , Recorder , ReplayError , Replayer } ;
8+ use crate :: rr:: {
9+ RREvent , RecordBuffer , Recorder , ReplayError , Replayer ,
10+ component_events:: MemorySliceWriteEvent , component_events:: ReallocEntryEvent ,
11+ } ;
12+ #[ cfg( all( feature = "rr-component" , feature = "rr-validate" ) ) ]
13+ use crate :: rr:: { Validate , component_events:: ReallocReturnEvent } ;
1314use crate :: runtime:: vm:: component:: {
1415 CallContexts , ComponentInstance , InstanceFlags , ResourceTable , ResourceTables ,
1516} ;
@@ -491,7 +492,7 @@ impl<'a, T: 'static> LowerContext<'a, T> {
491492 . 0
492493 . record_event ( || ReallocEntryEvent :: new ( old, old_size, old_align, new_size) ) ?;
493494 let result = self . realloc_inner ( old, old_size, old_align, new_size) ;
494- #[ cfg( feature = "rr-component" ) ]
495+ #[ cfg( all ( feature = "rr-component" , feature = "rr-validate" ) ) ]
495496 self . store
496497 . 0
497498 . record_event_validation ( || ReallocReturnEvent :: new ( & result) ) ?;
@@ -676,7 +677,8 @@ impl<'a, T: 'static> LowerContext<'a, T> {
676677 while !complete {
677678 let buf = self . store . 0 . replay_buffer_mut ( ) . unwrap ( ) ;
678679 let event = buf. next_event ( ) ?;
679- let _run_validate = buf. settings ( ) . validate && buf. trace_settings ( ) . add_validation ;
680+ #[ cfg( feature = "rr-validate" ) ]
681+ let run_validate = buf. settings ( ) . validate && buf. trace_settings ( ) . add_validation ;
680682 match event {
681683 RREvent :: ComponentHostFuncReturn ( e) => {
682684 // End of the lowering process
@@ -692,21 +694,21 @@ impl<'a, T: 'static> LowerContext<'a, T> {
692694 let _result =
693695 self . realloc_inner ( e. old_addr , e. old_size , e. old_align , e. new_size ) ;
694696 #[ cfg( feature = "rr-validate" ) ]
695- if _run_validate {
697+ if run_validate {
696698 _realloc_stack. push ( _result) ;
697699 }
698700 }
699701 // No return value to validate for lower/lower-store; store error and just check that entry happened before
700702 RREvent :: ComponentLowerReturn ( e) => {
701703 #[ cfg( feature = "rr-validate" ) ]
702- if _run_validate {
704+ if run_validate {
703705 _lower_stack. pop ( ) . ok_or ( ReplayError :: InvalidOrdering ) ?;
704706 }
705707 lowering_error = e. ret ( ) . map_err ( Into :: into) . err ( ) ;
706708 }
707709 RREvent :: ComponentLowerStoreReturn ( e) => {
708710 #[ cfg( feature = "rr-validate" ) ]
709- if _run_validate {
711+ if run_validate {
710712 _lower_store_stack
711713 . pop ( )
712714 . ok_or ( ReplayError :: InvalidOrdering ) ?;
@@ -730,21 +732,21 @@ impl<'a, T: 'static> LowerContext<'a, T> {
730732 RREvent :: ComponentReallocReturn ( _e) =>
731733 {
732734 #[ cfg( feature = "rr-validate" ) ]
733- if _run_validate {
735+ if run_validate {
734736 lowering_error = _e. validate ( & _realloc_stack. pop ( ) . unwrap ( ) ) . err ( )
735737 }
736738 }
737739 RREvent :: ComponentLowerEntry ( _) => {
738740 // All we want here is ensuring Entry occurs before Return
739741 #[ cfg( feature = "rr-validate" ) ]
740- if _run_validate {
742+ if run_validate {
741743 _lower_stack. push ( ( ) )
742744 }
743745 }
744746 RREvent :: ComponentLowerStoreEntry ( _) => {
745747 // All we want here is ensuring Entry occurs before Return
746748 #[ cfg( feature = "rr-validate" ) ]
747- if _run_validate {
749+ if run_validate {
748750 _lower_store_stack. push ( ( ) )
749751 }
750752 }
0 commit comments