Skip to content

impl From<Infallible> for io::Error #100411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion library/std/src/io/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -465,6 +465,13 @@ impl From<ErrorKind> for Error {
}
}

#[stable(feature = "io_error_from_infallible", since = "1.65.0")]
impl From<Infallible> 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.
Expand Down