Skip to content

Commit 79f2439

Browse files
committed
Impl fmt::Display for convert::Infallible.
1 parent 9562981 commit 79f2439

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libcore/convert.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
4949
#![stable(feature = "rust1", since = "1.0.0")]
5050

51+
use fmt;
52+
5153
/// A type used as the error type for implementations of fallible conversion
5254
/// traits in cases where conversions cannot actually fail.
5355
///
@@ -58,6 +60,12 @@
5860
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5961
pub enum Infallible {}
6062

63+
#[unstable(feature = "try_from", issue = "33417")]
64+
impl fmt::Display for Infallible {
65+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
66+
"an error of this type can never exist".fmt(f)
67+
}
68+
}
6169
/// A cheap reference-to-reference conversion. Used to convert a value to a
6270
/// reference value within generic code.
6371
///

0 commit comments

Comments
 (0)