ouroboros icon indicating copy to clipboard operation
ouroboros copied to clipboard

Make it possible to not allocate an AliasableBox when type is already StableDeref + AliasableDeref

Open Ten0 opened this issue 1 year ago • 0 comments

I've had two use-cases recently for Ouroboros structs where my borrowed field was already a StableDeref + AliasableDeref pointer. One was a std::cell::Ref, and one was an std::sync::Arc. In both cases, it seems significantly costly to make the additional allocation so that it gets wrapped into an AliasableBox, and that doesn't seem necessary for soundness.

It would be nice if we could put an annotation on the borrowed field so that instead of getting wrapped into AliasableBox, it just adds necessary assertions that the type is indeed StableDeref + AliasableDeref, and doesn't wrap it.

Ten0 avatar May 26 '24 22:05 Ten0