@RalfJung
Moreover, we already have newtypes, so if you want a reference-like thing, just make your own type and implement Deref and DerefMut . Maybe add some arbitrary-self for extra measure. Why would we want more than this?
I don’t think this approach would be very ergonomic with respect to user-defined coercions, e.g., from MyDSTref to MyDSTptr to raw pointer +/- mutability axis. Sure all these types could have methods that produces other types, but this does not feel as “built in” as normal references and pointers.
Then there is also the issue that @rkruppe mentions:
there’s no clear way to generalize this sort of pointer bit fiddling to library-defined smart pointers such as Box (well, almost library-defined) or Rc even when one can in principle imagine what a “tagged variant” of such a pointer would look like (which isn’t true for all smart pointers).
Whatever solution to this problem is proposed, it IMO has to work with Box, Rc, and others. How ? I don’t know, maybe finer grained separation of concerns would help, but as @rkruppe mentions things get really complex really quick and we get less and less value out of these.
I agree with you @RalfJung that this is tangentially off-topic, but I do think that these problems are related and that whatever solution we end up agreeing on for custom DSTs here will determine how this other problem can be solved, if at all (whether it is worth solving, is another issue).