Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
tokio
A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
I feel obligated to say again that I haven't fixed this issue, so my fork is still unsound because of StackedBorrows violations. And also, I haven't had any review, so maybe I also missed something. Granted, I mostly removed methods.
This looks like it should be reported to https://github.com/rustsec/advisory-db
As an example, there is a really good localisation framework called Project Fluent where you write your translatable expressions in a text file that later gets parsed. The resulting parse tree borrows entirely from the original text and doesn't make any allocations other than the occasional Vec for sequences.
If they do need to be string slices, you could wrap bytes::Bytes inside String from the string crate. Parsing generally results in a bunch of &strs borrowed from the String, and you'll want the slice_ref method added by this PR to turn the slices back into unborrowed String instances efficiently (no copying or UTF-8 checking, just incrementing an atomic reference counter).
As the author of self_cell I can attest, that writing unsafe lifetime abstractions is exceedingly tricky and you will get it wrong, repeatedly. I'm not sure these problems in owning_ref can be solved without a serious overhaul of the API. For one it tracks too little information, both ouroboros and self_cell independently reached the conclusion that you have to mark the dependent as either covariant or not_covariant over the owner lifetime, and prohibit ever leaking direct references if the dependent is not_covariant. But the fun doesn't stop there, if the owner can have a lifetime too, things get extra tricky. If you want to dive deeper take a look at this discussion https://github.com/Voultapher/self_cell/pull/29.
I'm the author of escher. In the initial implementation I had a soundness hole discovered by dtolnay https://github.com/petrosagg/escher/issues/1 which I "fixed" by disabling the corresponding function.