Somewhat Random Idea: Deref patterns

I don’t know if you read my earlier post on how to translate these things, the one I linked above. But following the example there, a rough translation could look something like this. [I changed the setting to allow for any smart pointer and instantiated it with `Box`.]

The important part is that guards don’t allow mutable access to the variables. I did some testing and just found out that there’s still the problem that the variable n is still considered to be a mutable reference even inside of the guard (example playground), and it just doesn’t allow for n or *n to be mutated or moved out of inside of the guard. [Error messages are e.g. “cannot borrow `*n` as mutable, as it is immutable for the pattern guard”.] So my translation, as linked above, is still inaccurate.

I’m not sure whether e.g. casting (transmuting) a &&T to &&mut T is a safe thing to do, if it is then this last problem with the guards be easily solved, because then you’d just need to replace every n with *m where m: &&mut T is the result of such a cast.