3 ms·
I think what you want is to enable box_patterns[0]. I have no idea why it isn't stable yet. [0] https://doc.rust-lang.org/beta/unstable-book/language-features/
by noam_k 3y ago
I think what you want is to enable box_patterns[0]. I have no idea why it isn't stable yet.
[0] https://doc.rust-lang.org/beta/unstable-book/language-features/box-patterns.html https://doc.rust-lang.org/beta/unstable-book/language-featur...
- ForkMeOnTinder 3y agoI believe it's not stable because it gives std::boxed::Box special treatment in the language. They'd rather find a solution that could work equally well for smart pointers defined outside of std. Box patterns are likely to be superseded by one of these: https://github.com/rust-lang/rust/issues/42640 https://github.com/rust-lang/rust/issues/42640 https://github.com/rust-lang/rust/issues/87121 https://github.com/rust-lang/rust/issues/87121
- Georgelemental 3y agoThe Rust language team wants a more general solution that also works with types like `Arc`, instead of hardcoding a special case for `Box` into the language. This is generally called "deref patterns." But there are tricky open design questions, so the effort is stalled until someone comes up with a proposal addressing them