4 ms·
non_exhaustive only affects downstream code, within the crate you can still treat it exhaustively. For example in this playground[0] if you build in test mode
by Nemo157 7y ago
non_exhaustive only affects downstream code, within the crate you can still treat it exhaustively. For example in this playground[0] if you build in test mode the match works inside the crate, but fails in the doc-test because that is treated as external code.
[0]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6ab1c7f5a94ca85915b114f97246b170 https://play.rust-lang.org/?version=stable&mode=debug&editio...
- est31 7y agoOh that's an interesting point, I didn't know that. I guess I'll use #[non_exhaustive] then after all.