mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
remove deprecated Error::description in impls
This commit is contained in:
@@ -787,18 +787,7 @@ fn is_unsupported(&self) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
const GLOBAL_POOL_ALREADY_INITIALIZED: &str =
|
||||
"The global thread pool has already been initialized.";
|
||||
|
||||
impl Error for ThreadPoolBuildError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
match self.kind {
|
||||
ErrorKind::GlobalPoolAlreadyInitialized => GLOBAL_POOL_ALREADY_INITIALIZED,
|
||||
ErrorKind::IOError(ref e) => e.description(),
|
||||
}
|
||||
}
|
||||
|
||||
fn source(&self) -> Option<&(dyn Error + 'static)> {
|
||||
match &self.kind {
|
||||
ErrorKind::GlobalPoolAlreadyInitialized => None,
|
||||
@@ -810,7 +799,9 @@ fn source(&self) -> Option<&(dyn Error + 'static)> {
|
||||
impl fmt::Display for ThreadPoolBuildError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match &self.kind {
|
||||
ErrorKind::GlobalPoolAlreadyInitialized => GLOBAL_POOL_ALREADY_INITIALIZED.fmt(f),
|
||||
ErrorKind::GlobalPoolAlreadyInitialized => {
|
||||
"The global thread pool has already been initialized.".fmt(f)
|
||||
}
|
||||
ErrorKind::IOError(e) => e.fmt(f),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2128,11 +2128,6 @@ fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
|
||||
#[stable(feature = "box_error", since = "1.8.0")]
|
||||
impl<E: Error> Error for Box<E> {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn description(&self) -> &str {
|
||||
Error::description(&**self)
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
fn cause(&self) -> Option<&dyn Error> {
|
||||
Error::cause(&**self)
|
||||
|
||||
@@ -608,12 +608,7 @@ impl<'a> From<String> for Box<dyn Error + Send + Sync + 'a> {
|
||||
fn from(err: String) -> Box<dyn Error + Send + Sync + 'a> {
|
||||
struct StringError(String);
|
||||
|
||||
impl Error for StringError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
impl Error for StringError {}
|
||||
|
||||
impl fmt::Display for StringError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
|
||||
@@ -136,10 +136,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
impl<'a, K: core::fmt::Debug + Ord, V: core::fmt::Debug> core::error::Error
|
||||
for crate::collections::btree_map::OccupiedError<'a, K, V>
|
||||
{
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"key already exists"
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, K: Ord, V, A: Allocator + Clone> Entry<'a, K, V, A> {
|
||||
|
||||
@@ -1061,17 +1061,10 @@ pub fn utf8_error(&self) -> Utf8Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoStringError {
|
||||
fn description(&self) -> &str {
|
||||
"C string contained non-utf8 bytes"
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "cstring_into", since = "1.7.0")]
|
||||
impl fmt::Display for IntoStringError {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.description().fmt(f)
|
||||
"C string contained non-utf8 bytes".fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1291,23 +1284,13 @@ fn ne(&self, other: &CString) -> bool {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl core::error::Error for NulError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"nul byte found in data"
|
||||
}
|
||||
}
|
||||
impl core::error::Error for NulError {}
|
||||
|
||||
#[stable(feature = "cstring_from_vec_with_nul", since = "1.58.0")]
|
||||
impl core::error::Error for FromVecWithNulError {}
|
||||
|
||||
#[stable(feature = "cstring_into", since = "1.7.0")]
|
||||
impl core::error::Error for IntoStringError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"C string contained non-utf8 bytes"
|
||||
}
|
||||
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
Some(&self.error)
|
||||
}
|
||||
|
||||
@@ -2285,20 +2285,10 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Error for FromUtf8Error {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"invalid utf-8"
|
||||
}
|
||||
}
|
||||
impl Error for FromUtf8Error {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Error for FromUtf16Error {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"invalid utf-16"
|
||||
}
|
||||
}
|
||||
impl Error for FromUtf16Error {}
|
||||
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
@@ -4113,11 +4113,6 @@ fn drop(&mut self) {
|
||||
|
||||
#[stable(feature = "arc_error", since = "1.52.0")]
|
||||
impl<T: core::error::Error + ?Sized> core::error::Error for Arc<T> {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn description(&self) -> &str {
|
||||
core::error::Error::description(&**self)
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
fn cause(&self) -> Option<&dyn core::error::Error> {
|
||||
core::error::Error::cause(&**self)
|
||||
|
||||
@@ -184,18 +184,12 @@
|
||||
impl fmt::Display for TryFromSliceError {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
#[allow(deprecated)]
|
||||
self.description().fmt(f)
|
||||
"could not convert slice to array".fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "try_from", since = "1.34.0")]
|
||||
impl Error for TryFromSliceError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"could not convert slice to array"
|
||||
}
|
||||
}
|
||||
impl Error for TryFromSliceError {}
|
||||
|
||||
#[stable(feature = "try_from_slice_error", since = "1.36.0")]
|
||||
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
|
||||
|
||||
@@ -193,21 +193,16 @@ enum CharErrorKind {
|
||||
}
|
||||
|
||||
#[stable(feature = "char_from_str", since = "1.20.0")]
|
||||
impl Error for ParseCharError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
match self.kind {
|
||||
CharErrorKind::EmptyString => "cannot parse char from empty string",
|
||||
CharErrorKind::TooManyChars => "too many characters in string",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Error for ParseCharError {}
|
||||
|
||||
#[stable(feature = "char_from_str", since = "1.20.0")]
|
||||
impl fmt::Display for ParseCharError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
#[allow(deprecated)]
|
||||
self.description().fmt(f)
|
||||
match self.kind {
|
||||
CharErrorKind::EmptyString => "cannot parse char from empty string",
|
||||
CharErrorKind::TooManyChars => "too many characters in string",
|
||||
}
|
||||
.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,9 +126,4 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "decode_utf16", since = "1.9.0")]
|
||||
impl Error for DecodeUtf16Error {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"unpaired surrogate found"
|
||||
}
|
||||
}
|
||||
impl Error for DecodeUtf16Error {}
|
||||
|
||||
@@ -958,11 +958,7 @@ fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "str_parse_error2", since = "1.8.0")]
|
||||
impl Error for Infallible {
|
||||
fn description(&self) -> &str {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
impl Error for Infallible {}
|
||||
|
||||
#[stable(feature = "convert_infallible", since = "1.34.0")]
|
||||
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
|
||||
|
||||
@@ -1042,11 +1042,6 @@ impl<'a> crate::iter::FusedIterator for Source<'a> {}
|
||||
|
||||
#[stable(feature = "error_by_ref", since = "1.51.0")]
|
||||
impl<'a, T: Error + ?Sized> Error for &'a T {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn description(&self) -> &str {
|
||||
Error::description(&**self)
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
fn cause(&self) -> Option<&dyn Error> {
|
||||
Error::cause(&**self)
|
||||
@@ -1062,36 +1057,16 @@ fn provide<'b>(&'b self, request: &mut Request<'b>) {
|
||||
}
|
||||
|
||||
#[stable(feature = "fmt_error", since = "1.11.0")]
|
||||
impl Error for crate::fmt::Error {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"an error occurred when formatting an argument"
|
||||
}
|
||||
}
|
||||
impl Error for crate::fmt::Error {}
|
||||
|
||||
#[stable(feature = "try_borrow", since = "1.13.0")]
|
||||
impl Error for crate::cell::BorrowError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"already mutably borrowed"
|
||||
}
|
||||
}
|
||||
impl Error for crate::cell::BorrowError {}
|
||||
|
||||
#[stable(feature = "try_borrow", since = "1.13.0")]
|
||||
impl Error for crate::cell::BorrowMutError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"already borrowed"
|
||||
}
|
||||
}
|
||||
impl Error for crate::cell::BorrowMutError {}
|
||||
|
||||
#[stable(feature = "try_from", since = "1.34.0")]
|
||||
impl Error for crate::char::CharTryFromError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"converted integer out of range for `char`"
|
||||
}
|
||||
}
|
||||
impl Error for crate::char::CharTryFromError {}
|
||||
|
||||
#[stable(feature = "duration_checked_float", since = "1.66.0")]
|
||||
impl Error for crate::time::TryFromFloatSecsError {}
|
||||
|
||||
@@ -497,16 +497,7 @@ enum AddrKind {
|
||||
|
||||
#[stable(feature = "addr_parse_error_error", since = "1.4.0")]
|
||||
impl fmt::Display for AddrParseError {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt.write_str(self.description())
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "addr_parse_error_error", since = "1.4.0")]
|
||||
impl Error for AddrParseError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {
|
||||
AddrKind::Ip => "invalid IP address syntax",
|
||||
AddrKind::Ipv4 => "invalid IPv4 address syntax",
|
||||
@@ -515,5 +506,9 @@ fn description(&self) -> &str {
|
||||
AddrKind::SocketV4 => "invalid IPv4 socket address syntax",
|
||||
AddrKind::SocketV6 => "invalid IPv6 socket address syntax",
|
||||
}
|
||||
.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "addr_parse_error_error", since = "1.4.0")]
|
||||
impl Error for AddrParseError {}
|
||||
|
||||
@@ -219,21 +219,16 @@ enum FloatErrorKind {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Error for ParseFloatError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
match self.kind {
|
||||
FloatErrorKind::Empty => "cannot parse float from empty string",
|
||||
FloatErrorKind::Invalid => "invalid float literal",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Error for ParseFloatError {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl fmt::Display for ParseFloatError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
#[allow(deprecated)]
|
||||
self.description().fmt(f)
|
||||
match self.kind {
|
||||
FloatErrorKind::Empty => "cannot parse float from empty string",
|
||||
FloatErrorKind::Invalid => "invalid float literal",
|
||||
}
|
||||
.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,19 +11,13 @@
|
||||
|
||||
#[stable(feature = "try_from", since = "1.34.0")]
|
||||
impl fmt::Display for TryFromIntError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
#[allow(deprecated)]
|
||||
self.description().fmt(fmt)
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
"out of range integral type conversion attempted".fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "try_from", since = "1.34.0")]
|
||||
impl Error for TryFromIntError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"out of range integral type conversion attempted"
|
||||
}
|
||||
}
|
||||
impl Error for TryFromIntError {}
|
||||
|
||||
#[stable(feature = "try_from", since = "1.34.0")]
|
||||
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
|
||||
@@ -128,15 +122,6 @@ pub const fn kind(&self) -> &IntErrorKind {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl fmt::Display for ParseIntError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
#[allow(deprecated)]
|
||||
self.description().fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Error for ParseIntError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
match self.kind {
|
||||
IntErrorKind::Empty => "cannot parse integer from empty string",
|
||||
IntErrorKind::InvalidDigit => "invalid digit found in string",
|
||||
@@ -144,5 +129,9 @@ fn description(&self) -> &str {
|
||||
IntErrorKind::NegOverflow => "number too small to fit in target type",
|
||||
IntErrorKind::Zero => "number would be zero for non-zero type",
|
||||
}
|
||||
.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Error for ParseIntError {}
|
||||
|
||||
@@ -124,12 +124,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Error for Utf8Error {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"invalid utf-8: corrupt contents"
|
||||
}
|
||||
}
|
||||
impl Error for Utf8Error {}
|
||||
|
||||
/// An error returned when parsing a `bool` using [`from_str`] fails
|
||||
///
|
||||
@@ -147,9 +142,4 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Error for ParseBoolError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"failed to parse bool"
|
||||
}
|
||||
}
|
||||
impl Error for ParseBoolError {}
|
||||
|
||||
@@ -927,7 +927,7 @@ pub const fn as_millis_f32(&self) -> f32 {
|
||||
pub fn from_secs_f64(secs: f64) -> Duration {
|
||||
match Duration::try_from_secs_f64(secs) {
|
||||
Ok(v) => v,
|
||||
Err(e) => panic!("{}", e.description()),
|
||||
Err(e) => panic!("{e}"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -964,7 +964,7 @@ pub fn from_secs_f64(secs: f64) -> Duration {
|
||||
pub fn from_secs_f32(secs: f32) -> Duration {
|
||||
match Duration::try_from_secs_f32(secs) {
|
||||
Ok(v) => v,
|
||||
Err(e) => panic!("{}", e.description()),
|
||||
Err(e) => panic!("{e}"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1445,8 +1445,9 @@ pub struct TryFromFloatSecsError {
|
||||
kind: TryFromFloatSecsErrorKind,
|
||||
}
|
||||
|
||||
impl TryFromFloatSecsError {
|
||||
const fn description(&self) -> &'static str {
|
||||
#[stable(feature = "duration_checked_float", since = "1.66.0")]
|
||||
impl fmt::Display for TryFromFloatSecsError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.kind {
|
||||
TryFromFloatSecsErrorKind::Negative => {
|
||||
"cannot convert float seconds to Duration: value is negative"
|
||||
@@ -1455,13 +1456,7 @@ const fn description(&self) -> &'static str {
|
||||
"cannot convert float seconds to Duration: value is either too big or NaN"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "duration_checked_float", since = "1.66.0")]
|
||||
impl fmt::Display for TryFromFloatSecsError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.description().fmt(f)
|
||||
.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1875,12 +1875,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[unstable(feature = "map_try_insert", issue = "82766")]
|
||||
impl<'a, K: fmt::Debug, V: fmt::Debug> Error for OccupiedError<'a, K, V> {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"key already exists"
|
||||
}
|
||||
}
|
||||
impl<'a, K: Debug, V: Debug> Error for OccupiedError<'a, K, V> {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S> {
|
||||
|
||||
@@ -296,15 +296,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "env", since = "1.0.0")]
|
||||
impl Error for VarError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
VarError::NotPresent => "environment variable not found",
|
||||
VarError::NotUnicode(..) => "environment variable was not valid unicode",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Error for VarError {}
|
||||
|
||||
/// Sets the environment variable `key` to the value `value` for the currently running
|
||||
/// process.
|
||||
|
||||
@@ -492,23 +492,15 @@ impl WriterPanicked {
|
||||
pub fn into_inner(self) -> Vec<u8> {
|
||||
self.buf
|
||||
}
|
||||
|
||||
const DESCRIPTION: &'static str =
|
||||
"BufWriter inner writer panicked, what data remains unwritten is not known";
|
||||
}
|
||||
|
||||
#[stable(feature = "bufwriter_into_parts", since = "1.56.0")]
|
||||
impl error::Error for WriterPanicked {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn description(&self) -> &str {
|
||||
Self::DESCRIPTION
|
||||
}
|
||||
}
|
||||
impl error::Error for WriterPanicked {}
|
||||
|
||||
#[stable(feature = "bufwriter_into_parts", since = "1.56.0")]
|
||||
impl fmt::Display for WriterPanicked {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", Self::DESCRIPTION)
|
||||
"BufWriter inner writer panicked, what data remains unwritten is not known".fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -179,12 +179,7 @@ fn from(iie: IntoInnerError<W>) -> Error {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn description(&self) -> &str {
|
||||
error::Error::description(self.error())
|
||||
}
|
||||
}
|
||||
impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<W> fmt::Display for IntoInnerError<W> {
|
||||
|
||||
@@ -1049,15 +1049,6 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl error::Error for Error {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn description(&self) -> &str {
|
||||
match self.repr.data() {
|
||||
ErrorData::Os(..) | ErrorData::Simple(..) => self.kind().as_str(),
|
||||
ErrorData::SimpleMessage(msg) => msg.message,
|
||||
ErrorData::Custom(c) => c.error.description(),
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
fn cause(&self) -> Option<&dyn error::Error> {
|
||||
match self.repr.data() {
|
||||
|
||||
@@ -3677,19 +3677,13 @@ fn partial_cmp(&self, other: &$lhs) -> Option<cmp::Ordering> {
|
||||
|
||||
#[stable(since = "1.7.0", feature = "strip_prefix")]
|
||||
impl fmt::Display for StripPrefixError {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.description().fmt(f)
|
||||
"prefix not found".fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(since = "1.7.0", feature = "strip_prefix")]
|
||||
impl Error for StripPrefixError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"prefix not found"
|
||||
}
|
||||
}
|
||||
impl Error for StripPrefixError {}
|
||||
|
||||
#[unstable(feature = "normalize_lexically", issue = "134694")]
|
||||
impl fmt::Display for NormalizeError {
|
||||
|
||||
@@ -1108,12 +1108,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> error::Error for SendError<T> {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"sending on a closed channel"
|
||||
}
|
||||
}
|
||||
impl<T> error::Error for SendError<T> {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> fmt::Debug for TrySendError<T> {
|
||||
@@ -1136,15 +1131,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> error::Error for TrySendError<T> {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
TrySendError::Full(..) => "sending on a full channel",
|
||||
TrySendError::Disconnected(..) => "sending on a closed channel",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<T> error::Error for TrySendError<T> {}
|
||||
|
||||
#[stable(feature = "mpsc_error_conversions", since = "1.24.0")]
|
||||
impl<T> From<SendError<T>> for TrySendError<T> {
|
||||
@@ -1168,12 +1155,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl error::Error for RecvError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"receiving on a closed channel"
|
||||
}
|
||||
}
|
||||
impl error::Error for RecvError {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl fmt::Display for TryRecvError {
|
||||
@@ -1186,15 +1168,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl error::Error for TryRecvError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
TryRecvError::Empty => "receiving on an empty channel",
|
||||
TryRecvError::Disconnected => "receiving on a closed channel",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl error::Error for TryRecvError {}
|
||||
|
||||
#[stable(feature = "mpsc_error_conversions", since = "1.24.0")]
|
||||
impl From<RecvError> for TryRecvError {
|
||||
@@ -1221,15 +1195,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "mpsc_recv_timeout_error", since = "1.15.0")]
|
||||
impl error::Error for RecvTimeoutError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
RecvTimeoutError::Timeout => "timed out waiting on channel",
|
||||
RecvTimeoutError::Disconnected => "channel is empty and sending half is closed",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl error::Error for RecvTimeoutError {}
|
||||
|
||||
#[stable(feature = "mpsc_error_conversions", since = "1.24.0")]
|
||||
impl From<RecvError> for RecvTimeoutError {
|
||||
|
||||
@@ -263,12 +263,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Error for PoisonError<T> {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"poisoned lock: another task failed inside"
|
||||
}
|
||||
}
|
||||
impl<T> Error for PoisonError<T> {}
|
||||
|
||||
impl<T> PoisonError<T> {
|
||||
/// Creates a `PoisonError`.
|
||||
@@ -376,17 +371,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Error for TryLockError<T> {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
#[cfg(panic = "unwind")]
|
||||
TryLockError::Poisoned(ref p) => p.description(),
|
||||
#[cfg(not(panic = "unwind"))]
|
||||
TryLockError::Poisoned(ref p) => match p._never {},
|
||||
TryLockError::WouldBlock => "try_lock failed because the operation would block",
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
fn cause(&self) -> Option<&dyn Error> {
|
||||
match *self {
|
||||
|
||||
@@ -452,12 +452,7 @@ pub struct NonIpSockAddr {
|
||||
host: String,
|
||||
}
|
||||
|
||||
impl error::Error for NonIpSockAddr {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"Failed to convert address to SocketAddr"
|
||||
}
|
||||
}
|
||||
impl error::Error for NonIpSockAddr {}
|
||||
|
||||
impl fmt::Display for NonIpSockAddr {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::hermit_abi;
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::marker::PhantomData;
|
||||
use crate::path::{self, PathBuf};
|
||||
@@ -52,12 +51,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"not supported on hermit yet"
|
||||
}
|
||||
}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
unsupported()
|
||||
|
||||
@@ -59,8 +59,7 @@ pub fn sgx_ineffective<T>(v: T) -> crate::io::Result<T> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_interrupted(code: i32) -> bool {
|
||||
use fortanix_sgx_abi::Error;
|
||||
code == Error::Interrupted as _
|
||||
code == fortanix_sgx_abi::Error::Interrupted as _
|
||||
}
|
||||
|
||||
pub fn decode_error_kind(code: i32) -> ErrorKind {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
use fortanix_sgx_abi::{Error, RESULT_SUCCESS};
|
||||
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::marker::PhantomData;
|
||||
use crate::path::{self, PathBuf};
|
||||
use crate::sys::{decode_error_kind, sgx_ineffective, unsupported};
|
||||
use crate::{fmt, io, str};
|
||||
use crate::{fmt, io};
|
||||
|
||||
pub fn errno() -> i32 {
|
||||
RESULT_SUCCESS
|
||||
@@ -59,12 +58,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"not supported in SGX yet"
|
||||
}
|
||||
}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
unsupported()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::{error, itron, unsupported};
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::path::{self, PathBuf};
|
||||
use crate::{fmt, io};
|
||||
@@ -58,12 +57,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"not supported on this platform yet"
|
||||
}
|
||||
}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
unsupported()
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use super::unsupported;
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::path::PathBuf;
|
||||
use crate::{fmt, io, path};
|
||||
@@ -62,12 +61,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"not supported on this platform yet"
|
||||
}
|
||||
}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
unsupported()
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
use r_efi::efi::protocols::{device_path, loaded_image_device_path};
|
||||
|
||||
use super::{RawOsError, helpers, unsupported_err};
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::marker::PhantomData;
|
||||
use crate::os::uefi;
|
||||
@@ -122,7 +121,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
let protocol = helpers::image_handle_protocol::<device_path::Protocol>(
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
use libc::{c_char, c_int, c_void};
|
||||
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{CStr, OsStr, OsString};
|
||||
use crate::os::unix::prelude::*;
|
||||
use crate::path::{self, PathBuf};
|
||||
@@ -248,12 +247,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"failed to join paths"
|
||||
}
|
||||
}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
#[cfg(target_os = "aix")]
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::unsupported;
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::marker::PhantomData;
|
||||
use crate::path::{self, PathBuf};
|
||||
@@ -51,12 +50,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"not supported on this platform yet"
|
||||
}
|
||||
}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
unsupported()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#![forbid(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{CStr, OsStr, OsString};
|
||||
use crate::marker::PhantomData;
|
||||
use crate::os::wasi::prelude::*;
|
||||
@@ -105,12 +104,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"not supported on wasm yet"
|
||||
}
|
||||
}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
unsupported()
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
use super::api;
|
||||
#[cfg(not(target_vendor = "uwp"))]
|
||||
use super::api::WinError;
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::os::windows::ffi::EncodeWide;
|
||||
use crate::os::windows::prelude::*;
|
||||
@@ -162,12 +161,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"failed to join paths"
|
||||
}
|
||||
}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
super::fill_utf16_buf(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::unsupported;
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::marker::PhantomData;
|
||||
use crate::os::xous::ffi::Error as XousError;
|
||||
@@ -110,12 +109,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"not supported on this platform yet"
|
||||
}
|
||||
}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
unsupported()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::unsupported;
|
||||
use crate::error::Error as StdError;
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::marker::PhantomData;
|
||||
use crate::path::{self, PathBuf};
|
||||
@@ -51,12 +50,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for JoinPathsError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"not supported on this platform yet"
|
||||
}
|
||||
}
|
||||
impl crate::error::Error for JoinPathsError {}
|
||||
|
||||
pub fn current_exe() -> io::Result<PathBuf> {
|
||||
unsupported()
|
||||
|
||||
@@ -717,12 +717,7 @@ pub const fn duration(&self) -> Duration {
|
||||
}
|
||||
|
||||
#[stable(feature = "time2", since = "1.8.0")]
|
||||
impl Error for SystemTimeError {
|
||||
#[allow(deprecated)]
|
||||
fn description(&self) -> &str {
|
||||
"other time was not earlier than self"
|
||||
}
|
||||
}
|
||||
impl Error for SystemTimeError {}
|
||||
|
||||
#[stable(feature = "time2", since = "1.8.0")]
|
||||
impl fmt::Display for SystemTimeError {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
impl Error for str::Utf8Error {
|
||||
//~^ ERROR cannot find trait `Error` in this scope
|
||||
//~| ERROR ambiguous associated type
|
||||
fn description(&self) {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//@ check-pass
|
||||
|
||||
use std::error::Error as StdError;
|
||||
use std::error::Error;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
@@ -51,7 +51,7 @@ impl<S> Stream for SseKeepAlive<S>
|
||||
where
|
||||
S: TryStream + Send + 'static,
|
||||
S::Ok: ServerSentEvent,
|
||||
S::Error: StdError + Send + Sync + 'static,
|
||||
S::Error: Error + Send + Sync + 'static,
|
||||
{
|
||||
type Item = Result<SseComment<&'static str>, ()>;
|
||||
fn poll_next(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Option<Self::Item>> {
|
||||
@@ -65,7 +65,7 @@ pub fn keep<S>(
|
||||
where
|
||||
S: TryStream + Send + 'static,
|
||||
S::Ok: ServerSentEvent + Send,
|
||||
S::Error: StdError + Send + Sync + 'static,
|
||||
S::Error: Error + Send + Sync + 'static,
|
||||
{
|
||||
SseKeepAlive { event_stream }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user