about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRune Tynan <runetynan@gmail.com>2024-11-21 13:36:42 -0800
committerRune Tynan <runetynan@gmail.com>2024-11-21 13:36:42 -0800
commit0a7e63a529c0c97e100f040fd34217e4b9d8143d (patch)
treea544d83499ae45b241eec5c5d57e05f4ce1aa3a8
parent6af006e988a8a522fbfac8dfdb6540fe001ebdf4 (diff)
downloadrust-0a7e63a529c0c97e100f040fd34217e4b9d8143d.tar.gz
rust-0a7e63a529c0c97e100f040fd34217e4b9d8143d.zip
Add comment about multiple errors to one ErrorKind
-rw-r--r--src/tools/miri/src/shims/io_error.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tools/miri/src/shims/io_error.rs b/src/tools/miri/src/shims/io_error.rs
index c29469f1edd..f67787e83f6 100644
--- a/src/tools/miri/src/shims/io_error.rs
+++ b/src/tools/miri/src/shims/io_error.rs
@@ -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),