Re: [PATCH v2 2/7] rust: cred: add Rust abstraction for `struct cred`

From: Alice Ryhl
Date: Tue Dec 12 2023 - 04:52:48 EST


On Mon, Dec 11, 2023 at 6:35 PM Boqun Feng <boqun.feng@xxxxxxxxx> wrote:
> On Mon, Dec 11, 2023 at 03:34:29PM +0000, Alice Ryhl wrote:
> > The safety comment explains what the signature means. I think that
> > should be enough.
> >
>
> For someone who has a good understanding of Rust lifetime (and the
> elision), yes. But I'm wondering whether all the people feel the same
> way.

The safety comment doesn't require understanding of lifetime elision
to be understood: "The signature of this function ensures that the
caller will only access the returned credential while the file is
still valid."

Yes, if you don't know the syntax for lifetimes, you'll have to trust
me that this is what the signature means. But I think that's the case
either way. I don't think it needs to be changed.

Alice