I\'m trying to port this program that computes the nth derivative of x^x symbolically to Rust. It seems to be mostly easy:
use std::rc::Rc;
typ
It appears that yes, it is currently impossible to do this. Recursive datatypes require indirection, e.g. Rc. Indirection requires dereferences when matching against nested patterns. There is no way to dereference inside a pattern match in Rust today.
The workaround is to compile your patterns by hand, i.e. as if you only had C-style switch.
A feature called "box patterns" has been discussed since 2014 that may solve this problem in the future but it hasn't shipped.