Original smart pointer without nightly

I am not good at English. Sorry if there are any funny expressions.

I am trying to create my own smart pointer with wrapping original smart pointer (ex: Rc).
However, CoerceUnsized and DispatchFromDyn are still nightly.
Therefore, my own smart pointers cannot functionally replace original types.

Is there any next best solution?
I wonder unsafe feature is needed.
If original smart pointer is the only member of the smart pointer, then transmute might help.
But otherwise I have no idea.

I am working on resolving this issue as part of the Rust for Linux project goal. You can find my RFC on the topic here. The RFC has already been accepted and we finished the remaining implementation work last week.

You can try the new derive macro on nightly today. The next steps are:

  1. Decide on the final name.
  2. Start using it in the Linux Kernel so that we have real world verification that the feature works.
  3. Once we have proof it works in the real world, it will be stabilized.

There are also some dependencies related to arbitrary self types, which the new feature requires.

6 Likes

I see that this is a very timely topic.

Indeed, I would be very happy if it could be implemented with derive macros.

And the fact that experts are working on this means that there doesn't seem to be an easy way to get enough functionality into our own smart pointer in Stable Rust at current time. It's a bit disappointing.

But I personally think this feature is very important and look forward to the future.
Thanks Rust developers.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.