Skip to content

Commit

Permalink
Add comment about multiple errors to one ErrorKind
Browse files Browse the repository at this point in the history
  • Loading branch information
CraftSpider committed Nov 21, 2024
1 parent 57a1885 commit ee005a3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/shims/io_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ const UNIX_IO_ERROR_TABLE: &[(&str, std::io::ErrorKind)] = {
// <https://github.com/rust-lang/rust/blob/master/library/std/src/sys/pal/windows/mod.rs>.
const WINDOWS_IO_ERROR_TABLE: &[(&str, std::io::ErrorKind)] = {
use std::io::ErrorKind::*;
// It's common for multiple error codes to map to the same io::ErrorKind. We have all for the
// forwards mapping; only the first one will be used for the backwards mapping.
// Slightly arbitrarily, we prefer non-WSA and the most generic sounding variant for backwards
// mapping.
&[
("WSAEADDRINUSE", AddrInUse),
("WSAEADDRNOTAVAIL", AddrNotAvailable),
Expand Down

0 comments on commit ee005a3

Please sign in to comment.