diff --git a/theories/typing/lib/rwlock/rwlock.v b/theories/typing/lib/rwlock/rwlock.v index a75c30b74c9169d2ee33bcb6955d4539396e96d0..fd50048884df235bd6da87541ac13336fcb9314f 100644 --- a/theories/typing/lib/rwlock/rwlock.v +++ b/theories/typing/lib/rwlock/rwlock.v @@ -189,7 +189,7 @@ Section rwlock. eqtype E L ty1 ty2 → eqtype E L (rwlock ty1) (rwlock ty2). Proof. eapply rwlock_proper. Qed. - (* TODO : apparently, we don't need to require ty to be sync, + (* Apparently, we don't need to require ty to be sync, contrarily to Rust's implementation. *) Global Instance rwlock_send : Send ty → Send (rwlock ty). diff --git a/theories/typing/lib/rwlock/rwlockreadguard.v b/theories/typing/lib/rwlock/rwlockreadguard.v index 64ae740d5d6c08cb471aea913747e563423d5d79..74bee0c89473610dbbb460cab90c34f33ce81a32 100644 --- a/theories/typing/lib/rwlock/rwlockreadguard.v +++ b/theories/typing/lib/rwlock/rwlockreadguard.v @@ -113,15 +113,16 @@ Section rwlockreadguard. eqtype E L (rwlockreadguard α1 ty1) (rwlockreadguard α2 ty2). Proof. intros. by eapply rwlockreadguard_proper. Qed. + (* Rust requires the type to also be Send. Not sure why. *) Global Instance rwlockreadguard_sync α ty : Sync ty → Sync (rwlockreadguard α ty). Proof. move=>?????/=. apply uPred.exist_mono=>?. by rewrite sync_change_tid. Qed. - (* Probably for reasons related to the underlying representation, - Rust does not implement Send for RwLockWriteGuard. We could prove - this. *) + (* POSIX requires the unlock to occur from the thread that acquired + the lock, so Rust does not implement Send for RwLockWriteGuard. We could + prove this. *) End rwlockreadguard. Hint Resolve rwlockreadguard_mono' rwlockreadguard_proper' : lrust_typing. diff --git a/theories/typing/lib/rwlock/rwlockwriteguard.v b/theories/typing/lib/rwlock/rwlockwriteguard.v index b439613c138162fa8879b04525246a3078f079a0..22521426d9a8ac787bca9c8b1ec804199e07316f 100644 --- a/theories/typing/lib/rwlock/rwlockwriteguard.v +++ b/theories/typing/lib/rwlock/rwlockwriteguard.v @@ -116,6 +116,7 @@ Section rwlockwriteguard. eqtype E L (rwlockwriteguard α1 ty1) (rwlockwriteguard α2 ty2). Proof. intros. by eapply rwlockwriteguard_proper. Qed. + (* Rust requires the type to also be Send. Not sure why. *) Global Instance rwlockwriteguard_sync α ty : Sync ty → Sync (rwlockwriteguard α ty). Proof. @@ -123,9 +124,9 @@ Section rwlockwriteguard. by rewrite sync_change_tid. Qed. - (* Probably for reasons related to the underlying representation, - Rust does not implement Send for RwLockWriteGuard. We could prove - this. *) + (* POSIX requires the unlock to occur from the thread that acquired + the lock, so Rust does not implement Send for RwLockWriteGuard. We could + prove this. *) End rwlockwriteguard. Hint Resolve rwlockwriteguard_mono' rwlockwriteguard_proper' : lrust_typing.