Allocations on the stack are limited by the stack size, which is only a few megabytes, not your total memory. You should be able to file a bug to the Rust github repo for this, since it seems like it attempted to store a 23 MB object on the stack.
For now you may be able to configure the stack size, but I'm not sure how.