Re: [PATCH RFC] rust: maple_tree: implement Send and Sync for MapleTree

From: Joel Fernandes

Date: Mon Apr 20 2026 - 19:42:40 EST




On 4/20/2026 6:00 PM, Daniel Almeida wrote:
> Hi Joel,
>
> I think there are others in a better position to review this than me,
> however, while reading this patch, I noticed this:
>>
>> #[inline]
>> @@ -302,19 +305,31 @@ fn drop(mut self: Pin<&mut Self>) {
>> }
>> }
>>
>> +// SAFETY: `MapleTree<T>` is `Send` iff `T` is `Send`. All access to the tree
>> +// goes through the internal `ma_lock` spinlock or via `&mut MapleTree`.
>> +unsafe impl<T: ForeignOwnable + Send> Send for MapleTree<T> {}
>> +// SAFETY: All shared access through `&MapleTree` either acquires `ma_lock`.
>
> ^ Missing something here? Either … or?
>
Yes, it should be either acquires `ma_lock` or uses &mut. I will adjust it.

thanks,

--
Joel Fernandes