[PATCH 7 of 7] rust-cpython: mark all PyLeaked methods as unsafe

Yuya Nishihara yuya at tcha.org
Tue Oct 22 08:53:20 EDT 2019


On Tue, 22 Oct 2019 14:43:53 +0200, Raphaël Gomès wrote:
> On 10/22/19 10:11 AM, Yuya Nishihara wrote:
> > diff --git a/rust/hg-cpython/src/ref_sharing.rs b/rust/hg-cpython/src/ref_sharing.rs
> > --- a/rust/hg-cpython/src/ref_sharing.rs
> > +++ b/rust/hg-cpython/src/ref_sharing.rs
> > @@ -294,7 +294,13 @@ impl<T> PyLeaked<T> {
> >       /// Immutably borrows the wrapped value.
> >       ///
> >       /// Borrowing fails if the underlying reference has been invalidated.
> > -    pub fn try_borrow<'a>(
> > +    ///
> > +    /// # Safety
> > +    ///
> > +    /// The lifetime of the innermost object is cheated. Do not obtain and
> 
> Nit: I feel like "cheated" is not the right term. I think "artificial"
> might be better suited? I don't care enough if it gets in however

Perhaps. I'll revise the docstring when sending pullreq. Thanks.


More information about the Mercurial-devel mailing list