On 2/23/2026 4:38 AM, Alice Ryhl wrote:
> On Sun, Feb 22, 2026 at 07:41:44PM -0500, Joel Fernandes wrote:
>> Hi Alice,
>>
>> On 2/21/2026 3:59 AM, Alice Ryhl wrote:
>>> On Wed, Feb 18, 2026 at 03:55:03PM -0500, Joel Fernandes wrote:
>>>> +impl CListHead {
>>>> +    /// Create a `&CListHead` reference from a raw `list_head` pointer.
>>>> +    ///
>>>> +    /// # Safety
>>>> +    ///
>>>> +    /// - `ptr` must be a valid pointer to an allocated and initialized 
>>>> `list_head` structure.
>>>> +    /// - `ptr` must remain valid and unmodified for the lifetime `'a`.
>>>> +    /// - The list and all linked `list_head` nodes must not be modified 
>>>> by non-Rust code
>>>> +    ///   for the lifetime `'a`.
>>>
>>> I don't think C vs Rust is useful here. What you want is that the list
>>> is not modified by random other code in ways you didn't expect. It
>>> doesn't matter if it's C or Rust code that carries out the illegal
>>> modification.
>>
>> Yeah, this is true. I will change it to the following then:
>>
>> "The list and all linked `list_head` nodes must not be modified from
>> anywhere for the lifetime `'a`."
> 
> Ok. Perhaps you should say that it must not be modified except through
> this CListHead? I guess it depends on whether you want to add methods
> for changing the list via this API.
> 
At the moment, there isn't a usecase for it but I would predict we would want it
for other such use cases, so yet I will change it to your suggestion to
future-proof it:

"The list and all linked `list_head` nodes must not be modified from
anywhere for the lifetime `'a`, unless done so via any `ClistHead` APIs."

Let me know if it looks good?

thanks,

--
Joel Fernandes

Reply via email to