diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs index ff7fdcae16f53..514cfcd37ca2b 100644 --- a/library/std/src/io/error.rs +++ b/library/std/src/io/error.rs @@ -11,7 +11,7 @@ mod repr_unpacked; #[cfg(not(target_pointer_width = "64"))] use repr_unpacked::Repr; -use crate::convert::From; +use crate::convert::{From, Infallible}; use crate::error; use crate::fmt; use crate::result; @@ -465,6 +465,13 @@ impl From for Error { } } +#[stable(feature = "io_error_from_infallible", since = "1.65.0")] +impl From for Error { + fn from(infallible: Infallible) -> Error { + match infallible {} + } +} + impl Error { /// Creates a new I/O error from a known kind of error as well as an /// arbitrary error payload.