mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-05 09:23:31 +00:00
std: map ENOTSUP to ErrorKind::Unsupported `ENOTSUP` and `EOPNOTSUPP` both mean the operation isn't supported. They're the same value on some targets (Linux, FreeBSD), where the existing `EOPNOTSUPP => Unsupported` arm (rust-lang/rust#139822) already covers both, and different on others (Apple, OpenBSD), where `ENOTSUP` decodes to `Uncategorized` instead. I don't see a reason to treat it differently, so this maps `ENOTSUP` to `Unsupported` as well. It uses a match guard rather than an or-pattern, since the two are equal on the targets where they alias and an or-pattern would be unreachable there. Same shape as the `EAGAIN`/`EWOULDBLOCK` arm just below: ```rust x if x == libc::EOPNOTSUPP || x == libc::ENOTSUP => Unsupported, ``` This was raised once before (rust-lang/rust#125228) and closed, since both errnos were left out of the original `Unsupported` PR (rust-lang/rust#78880). rust-lang/rust#139822 has since added `EOPNOTSUPP`, so the same reasoning now covers `ENOTSUP`. I didn't add a test, since the decode arms aren't tested today. r? libs