File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -862,6 +862,10 @@ mod tests {
862862 ) ;
863863 }
864864
865+ ///
866+ /// Tests that unnatural parent->child relationships in nested async
867+ /// operations behave properly.
868+ ///
865869 #[ tokio:: test]
866870 async fn test_out_of_order_context_detachment_futures ( ) {
867871 // This function returns a future, but doesn't await it
@@ -872,7 +876,6 @@ mod tests {
872876 async {
873877 assert_eq ! ( Context :: current( ) . get:: <ValueA >( ) , Some ( & ValueA ( 42 ) ) ) ;
874878
875- let _guard = Context :: new ( ) . with_value ( ValueB ( 2 ) ) . attach ( ) ;
876879 // Longer work
877880 sleep ( Duration :: from_millis ( 50 ) ) . await ;
878881 }
@@ -885,8 +888,8 @@ mod tests {
885888 // await our nested function, which will create and detach a context
886889 let future = create_a_future ( ) . with_context ( parent_cx) . await ;
887890
888- // Execute the future. The completion of the future will result in an out-of-order drop,
889- // as the parent context created by create_a_future was already dropped earlier .
891+ // Execute the future. The future that created it is long gone, but this shouldn't
892+ // cause issues .
890893 let _a = future. await ;
891894
892895 // Nothing terrible (e.g., panics!) should happen, and we should definitely not have any
Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ macro_rules! otel_debug {
142142 {
143143 print!( "otel_debug: name={}\n " , $name) ;
144144 }
145-
145+
146146 #[ cfg( all( not( feature = "internal-logs" ) , not( test) ) ) ]
147147 {
148148 let _ = $name; // Compiler will optimize this out as it's unused.
You can’t perform that action at this time.
0 commit comments