@@ -54,6 +54,9 @@ macro_rules! instrumentation_hook_fn_defs {
5454
5555macro_rules! impl_kv_instrumentation_pass {
5656 ( ) => {
57+ fn as_any( & self ) -> & dyn std:: any:: Any {
58+ self as & dyn std:: any:: Any
59+ }
5760 fn coverage( & self ) -> & AssociatedCoverageArray <Self :: Key , Self :: Value > {
5861 & self . coverage
5962 }
@@ -70,13 +73,14 @@ macro_rules! impl_kv_instrumentation_pass {
7073}
7174pub ( crate ) use impl_kv_instrumentation_pass;
7275
73- pub ( crate ) trait KVInstrumentationPass : Any {
76+ pub ( crate ) trait KVInstrumentationPass {
7477 type Key : Into < Location > + Ord + Clone ; // = Location
7578 type Value : FeedbackLattice + ' static ;
7679
7780 /// Returns a short string (<12 chars) that describes this specific pass
7881 fn shortcode ( & self ) -> & ' static str ;
7982
83+ fn as_any ( & self ) -> & dyn Any ;
8084 fn coverage ( & self ) -> & AssociatedCoverageArray < Self :: Key , Self :: Value > ;
8185 fn coverage_mut ( & mut self ) -> & mut AssociatedCoverageArray < Self :: Key , Self :: Value > ;
8286
@@ -137,6 +141,8 @@ pub(crate) trait CodeCovInstrumentationPass {
137141 . unwrap ( ) ,
138142 )
139143 }
144+
145+ fn as_any ( & self ) -> & dyn Any ;
140146}
141147
142148pub ( crate ) trait HashBitsetInstrumentationPass {
@@ -166,16 +172,19 @@ pub(crate) trait HashBitsetInstrumentationPass {
166172 . unwrap ( ) ,
167173 )
168174 }
175+
176+ fn as_any ( & self ) -> & dyn Any ;
169177}
170178
171- pub trait ErasedInstrumentationPass : Any {
179+ pub trait ErasedInstrumentationPass {
172180 instrumentation_hook_fn_defs ! ( no_body) ;
173181
174182 fn update_and_scan_coverage ( & mut self ) -> bool ;
175183 fn reset_coverage ( & mut self ) ;
176184 fn reset_coverage_keep_saved ( & mut self ) ;
177185 fn snapshot_coverage ( & self ) -> CovSnapshot ;
178186 fn shortcode ( & self ) -> & ' static str ;
187+ fn as_any ( & self ) -> & dyn Any ;
179188}
180189
181190macro_rules! dispatch {
@@ -210,4 +219,5 @@ impl<K: Ord + Into<Location> + Clone + 'static, V: FeedbackLattice + 'static>
210219 dispatch ! ( reset_coverage_keep_saved( & mut self ) -> ( ) ) ;
211220 dispatch ! ( snapshot_coverage( & self ) -> CovSnapshot ) ;
212221 dispatch ! ( shortcode( & self ) -> & ' static str ) ;
222+ dispatch ! ( as_any( & self ) -> & dyn Any ) ;
213223}
0 commit comments