It's common to define MemoryRegionOps<T> and VMStateDescription<T> as
static variables, and this requires T to implement Sync.

Migratable<T> is usually embedded in device state, so it's necessary to
implement Sync for Migratable<T>.

Signed-off-by: Zhao Liu <[email protected]>
---
 rust/migration/src/migratable.rs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/rust/migration/src/migratable.rs b/rust/migration/src/migratable.rs
index ded6fe8f4a6c..5c47c7d1c2fa 100644
--- a/rust/migration/src/migratable.rs
+++ b/rust/migration/src/migratable.rs
@@ -340,6 +340,9 @@ pub struct Migratable<T: ToMigrationStateShared> {
     runtime_state: T,
 }
 
+// SAFETY: the migration_state asserts via `BqlCell` that the BQL is taken.
+unsafe impl<T: ToMigrationStateShared + Sync> Sync for Migratable<T> {}
+
 impl<T: ToMigrationStateShared> std::ops::Deref for Migratable<T> {
     type Target = T;
 
-- 
2.34.1


Reply via email to