Files
rust/library/std
Jacob Pratt cdde1d2c1d Rollup merge of #158580 - valentynkit:enotsup-unsupported, r=workingjubilee
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
2026-08-17 23:26:52 -04:00
..
2026-06-30 09:01:03 +00:00
2026-07-29 13:01:15 -07:00