Skip to content

Commit 3ad1e4d

Browse files
committed
WIP: make Infallible an alias for !
1 parent 5ef3eb6 commit 3ad1e4d

File tree

3 files changed

+1
-80
lines changed

3 files changed

+1
-80
lines changed

library/core/src/convert/mod.rs

+1-64
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
3535
#![stable(feature = "rust1", since = "1.0.0")]
3636

37-
use crate::fmt;
38-
use crate::hash::{Hash, Hasher};
39-
4037
mod num;
4138

4239
#[unstable(feature = "convert_float_to_int", issue = "67057")]
@@ -675,64 +672,4 @@ impl AsRef<str> for str {
675672
///
676673
/// [never]: ../../std/primitive.never.html
677674
#[stable(feature = "convert_infallible", since = "1.34.0")]
678-
#[derive(Copy)]
679-
pub enum Infallible {}
680-
681-
#[stable(feature = "convert_infallible", since = "1.34.0")]
682-
impl Clone for Infallible {
683-
fn clone(&self) -> Infallible {
684-
match *self {}
685-
}
686-
}
687-
688-
#[stable(feature = "convert_infallible", since = "1.34.0")]
689-
impl fmt::Debug for Infallible {
690-
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
691-
match *self {}
692-
}
693-
}
694-
695-
#[stable(feature = "convert_infallible", since = "1.34.0")]
696-
impl fmt::Display for Infallible {
697-
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
698-
match *self {}
699-
}
700-
}
701-
702-
#[stable(feature = "convert_infallible", since = "1.34.0")]
703-
impl PartialEq for Infallible {
704-
fn eq(&self, _: &Infallible) -> bool {
705-
match *self {}
706-
}
707-
}
708-
709-
#[stable(feature = "convert_infallible", since = "1.34.0")]
710-
impl Eq for Infallible {}
711-
712-
#[stable(feature = "convert_infallible", since = "1.34.0")]
713-
impl PartialOrd for Infallible {
714-
fn partial_cmp(&self, _other: &Self) -> Option<crate::cmp::Ordering> {
715-
match *self {}
716-
}
717-
}
718-
719-
#[stable(feature = "convert_infallible", since = "1.34.0")]
720-
impl Ord for Infallible {
721-
fn cmp(&self, _other: &Self) -> crate::cmp::Ordering {
722-
match *self {}
723-
}
724-
}
725-
726-
#[stable(feature = "convert_infallible", since = "1.34.0")]
727-
impl From<!> for Infallible {
728-
fn from(x: !) -> Self {
729-
x
730-
}
731-
}
732-
733-
#[stable(feature = "convert_infallible_hash", since = "1.44.0")]
734-
impl Hash for Infallible {
735-
fn hash<H: Hasher>(&self, _: &mut H) {
736-
match *self {}
737-
}
738-
}
675+
pub type Infallible = !;

library/core/src/num/error.rs

-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Error types for conversion to integral types.
22
3-
use crate::convert::Infallible;
43
use crate::fmt;
54

65
/// The error type returned when a checked integral type conversion fails.
@@ -28,13 +27,6 @@ impl fmt::Display for TryFromIntError {
2827
}
2928
}
3029

31-
#[stable(feature = "try_from", since = "1.34.0")]
32-
impl From<Infallible> for TryFromIntError {
33-
fn from(x: Infallible) -> TryFromIntError {
34-
match x {}
35-
}
36-
}
37-
3830
#[stable(feature = "never_type", since = "1.49.0")]
3931
impl From<!> for TryFromIntError {
4032
fn from(never: !) -> TryFromIntError {

library/std/src/error.rs

-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
mod tests;
1818

1919
use core::array;
20-
use core::convert::Infallible;
2120

2221
use crate::alloc::{AllocError, LayoutError};
2322
use crate::any::TypeId;
@@ -456,13 +455,6 @@ impl Error for string::FromUtf16Error {
456455
}
457456
}
458457

459-
#[stable(feature = "str_parse_error2", since = "1.8.0")]
460-
impl Error for Infallible {
461-
fn description(&self) -> &str {
462-
match *self {}
463-
}
464-
}
465-
466458
#[stable(feature = "decode_utf16", since = "1.9.0")]
467459
impl Error for char::DecodeUtf16Error {
468460
#[allow(deprecated)]

0 commit comments

Comments
 (0)