rt: EnterGuard should not be Send (#5766)

Removes `Send` from `EnterGuard` (returned by `Handle::enter()`. The
guard type changes a thread-local variable on drop. If the guard is
moved to a different thread, it would modify the wrong thread-local.

This is a **breaking change** but it fixes a bug and prevents incorrect
user behavior. If user code breaks because of this, it is because they
(most likely) have a bug in their code.
This commit is contained in:
Carl Lerche
2023-06-05 14:09:43 -07:00
committed by GitHub
parent 15712018da
commit e75ca93d30
4 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -532,7 +532,7 @@ async_assert_fn!(tokio::task::unconstrained(BoxFutureSend<()>): Send & !Sync & U
async_assert_fn!(tokio::task::unconstrained(BoxFutureSync<()>): Send & Sync & Unpin);
assert_value!(tokio::runtime::Builder: Send & Sync & Unpin);
assert_value!(tokio::runtime::EnterGuard<'_>: Send & Sync & Unpin);
assert_value!(tokio::runtime::EnterGuard<'_>: !Send & Sync & Unpin);
assert_value!(tokio::runtime::Handle: Send & Sync & Unpin);
assert_value!(tokio::runtime::Runtime: Send & Sync & Unpin);