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

Raphaël Gomès raphael.gomes at octobus.net
Wed Oct 23 03:49:30 EDT 2019


FYI, Georges is currently on vacation, don't expect an answer for at 
least a week.

On 10/22/19 2:53 PM, Yuya Nishihara wrote:
> 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.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list