@@ -113,6 +113,61 @@ fn test_external_call() {
113113 may_invoke_callback4 ( |x| sink ( a) ) ; // $ hasValueFlow=81
114114}
115115
116+ mod async_blocks {
117+ use super :: { sink, source} ;
118+
119+ async fn async_block_flow_out ( ) {
120+ let future = async { source ( 206 ) } ;
121+ sink ( future. await ) ; // $ MISSING: hasValueFlow=206
122+ }
123+
124+ async fn async_block_flow_in ( ) {
125+ let data = source ( 207 ) ;
126+ async {
127+ sink ( data) ; // $ MISSING: hasValueFlow=207
128+ }
129+ . await ;
130+ }
131+
132+ async fn async_block_flow_through ( ) {
133+ let data = source ( 208 ) ;
134+ let future = async { data } ;
135+ sink ( future. await ) ; // $ MISSING: hasValueFlow=208
136+ }
137+
138+ async fn async_block_captured_variable ( ) {
139+ let mut captured = 1 ;
140+ sink ( captured) ;
141+ async {
142+ captured = source ( 209 ) ;
143+ }
144+ . await ;
145+ sink ( captured) ; // $ MISSING: hasValueFlow=209
146+ }
147+
148+ async fn boxed_async_block_captured_variable ( ) {
149+ let mut captured = 1 ;
150+ sink ( captured) ;
151+ Box :: pin ( async {
152+ captured = source ( 210 ) ;
153+ } )
154+ . await ;
155+ sink ( captured) ; // $ MISSING: hasValueFlow=210
156+ }
157+
158+ async fn test_async_blocks ( ) {
159+ async_block_flow_out ( ) . await ;
160+ async_block_flow_in ( ) . await ;
161+ async_block_flow_through ( ) . await ;
162+ async_block_captured_variable ( ) . await ;
163+ boxed_async_block_captured_variable ( ) . await ;
164+ }
165+
166+ pub fn main ( ) {
167+ futures:: executor:: block_on ( test_async_blocks ( ) ) ;
168+ }
169+ }
170+
116171fn main ( ) {
117172 closure_flow_out ( ) ;
118173 closure_flow_in ( ) ;
@@ -123,4 +178,5 @@ fn main() {
123178 function_flows_through ( ) ;
124179 test_apply ( ) ;
125180 test_apply_wrap ( ) ;
181+ async_blocks:: main ( ) ;
126182}
0 commit comments