@@ -161,7 +161,9 @@ macro_rules! convenient_run {
161161}
162162
163163impl StartTransaction < & mut ClientSession > {
164- /// Starts a transaction, runs the given callback, and commits or aborts the transaction.
164+ /// Starts a transaction, runs the given callback, and commits or aborts the transaction. In
165+ /// most circumstances, [`and_run2`](StartTransaction::and_run2) will be more convenient.
166+ ///
165167 /// Transient transaction errors will cause the callback or the commit to be retried;
166168 /// other errors will cause the transaction to be aborted and the error returned to the
167169 /// caller. If the callback needs to provide its own error information, the
@@ -207,7 +209,6 @@ impl StartTransaction<&mut ClientSession> {
207209 /// # Ok(())
208210 /// # }
209211 /// ```
210- #[ rustversion:: attr( since( 1.85 ) , deprecated = "use and_run2" ) ]
211212 pub async fn and_run < R , C , F > ( self , mut context : C , mut callback : F ) -> Result < R >
212213 where
213214 F : for < ' b > FnMut ( & ' b mut ClientSession , & ' b mut C ) -> BoxFuture < ' b , Result < R > > ,
@@ -225,6 +226,7 @@ impl StartTransaction<&mut ClientSession> {
225226 }
226227
227228 /// Starts a transaction, runs the given callback, and commits or aborts the transaction.
229+ ///
228230 /// Transient transaction errors will cause the callback or the commit to be retried;
229231 /// other errors will cause the transaction to be aborted and the error returned to the
230232 /// caller. If the callback needs to provide its own error information, the
@@ -243,6 +245,13 @@ impl StartTransaction<&mut ClientSession> {
243245 /// avoids the lifetime issues of `and_run`, but is only available in Rust versions 1.85 and
244246 /// above.
245247 ///
248+ /// In some circumstances, using this method can trigger a
249+ /// [compiler bug](https://github.com/rust-lang/rust/issues/96865) that results in
250+ /// `implementation of Send is not general enough` errors. If this is encountered, we
251+ /// recommend these workarounds:
252+ /// * Avoid capturing references in the transaction closure (e.g. by cloning)
253+ /// * Use the `context` parameter of [`and_run`](StartTransaction::and_run).
254+ ///
246255 /// Because the callback can be repeatedly executed, code within the callback cannot consume
247256 /// owned values, even values owned by the callback itself:
248257 ///
0 commit comments