Mercurial > public > mercurial-scm > hg-stable
comparison rust/pyo3-sharedref/tests/test_sharedref.rs @ 52640:78b2894cd58c
rust-pyo3-sharedref: demonstrate SharedByPyObject borrow unsafety
We take the existing doc-comment from rust-cpython and make it
compile (validated by `cargo test`). With the added explanations,
the ordinary comment was no longer useful, we could therefore
remove it.
The new explanation stresses that "not leaking the internal faked
reference" is definitely not enough, because the problem is about
*all references* that can be derived from it.
We ended up duplicating the explanation, because that is a way
to ensure that people do not miss it. Also, it was a bit misleading
that the previous example was for `try_borrow_mut()`, so we made
a similar, simpler one for `try_borrow()`.
author | Georges Racinet <georges.racinet@cloudcrane.io> |
---|---|
date | Mon, 16 Dec 2024 13:08:55 +0100 |
parents | ac0cb3c334a1 |
children |
comparison
equal
deleted
inserted
replaced
52639:76a0bdb0e4ca | 52640:78b2894cd58c |
---|