Smart pointer which owns its target

To me it feels more like "tip of the iceberg" rather than "molehill into mountain". Disclosure: I'm not a native English speaker, so I might have also misinterpreted that phrase.


Rethinking about this, I assume my main problem is that all this background knowledge which I now (hopefully correctly) gained was not accessible to me beforehand (or maybe it was, but I didn't know where to look).

This leads me to another question: I wonder if these details are commonly known within the Rust community. Maybe most people don't usually care or don't need to know, but I feel like these details are really vital if you want to truly understand what AsRef is about. (And they help if you are lost.)

Moreover, deref-coercion and Option::as_ref make things even more complicated for many users.

I feel like the details regarding the AsRef blanket implementations (and possibly also Cow's) need to be added somewhere to std::convert's and std::borrow's documentation. What do you think?


For the record: I entirely disagree. :laughing:

What you wrote was very helpful for me, and I also believe it is important for the future of Rust: Even if std will not be changed in any way, I think this is very important for purposes of documentation and helping people to get a deeper understanding. It may also help to "handle" issues/PRs like #73390 in ways that are more satisfying for the original reporter(s) than just: "It's a breaking change. Not worth the effort. Learn to live with the warts. Wontfix. Closed." (I'm exaggerating a bit to make my point here.)