Implement Error for OccupiedError.

This commit is contained in:
Mara Bos
2021-03-04 15:57:26 +01:00
parent 69d95e232a
commit d85d82ab22
4 changed files with 45 additions and 0 deletions

View File

@@ -470,6 +470,24 @@ impl Error for char::DecodeUtf16Error {
}
}
#[unstable(feature = "map_try_insert", issue = "none")]
impl<'a, K: Debug + Ord, V: Debug> Error
for crate::collections::btree_map::OccupiedError<'a, K, V>
{
#[allow(deprecated)]
fn description(&self) -> &str {
"key already exists"
}
}
#[unstable(feature = "map_try_insert", issue = "none")]
impl<'a, K: Debug, V: Debug> Error for crate::collections::hash_map::OccupiedError<'a, K, V> {
#[allow(deprecated)]
fn description(&self) -> &str {
"key already exists"
}
}
#[stable(feature = "box_error", since = "1.8.0")]
impl<T: Error> Error for Box<T> {
#[allow(deprecated, deprecated_in_future)]