@@ -121,7 +121,7 @@ pub unsafe trait UserData: Sized + Clone {
121
121
122
122
/// Trait for wrappers that can be mapped immutably.
123
123
pub trait Map : UserData {
124
- type Err : Debug ;
124
+ type Err : std :: error :: Error ;
125
125
126
126
/// Maps a `&T` to `U`. Called for methods that take `&self`.
127
127
///
@@ -134,7 +134,7 @@ pub trait Map: UserData {
134
134
135
135
/// Trait for wrappers that can be mapped mutably.
136
136
pub trait MapMut : UserData {
137
- type Err : Debug ;
137
+ type Err : std :: error :: Error ;
138
138
139
139
/// Maps a `&mut T` to `U`. Called for methods that take `&mut self`.
140
140
///
@@ -147,7 +147,7 @@ pub trait MapMut: UserData {
147
147
148
148
/// Trait for wrappers that can be mapped once.
149
149
pub trait MapOwned : UserData {
150
- type Err : Debug ;
150
+ type Err : std :: error :: Error ;
151
151
152
152
/// Maps a `T` to `U`. Called for methods that take `self`. This method may fail with
153
153
/// an error if it is called more than once on the same object.
@@ -168,10 +168,11 @@ pub type DefaultUserData<T> = LocalCellData<T>;
168
168
#[ allow( clippy:: exhaustive_enums) ] // explicitly uninhabited
169
169
pub enum Infallible { }
170
170
171
+ impl std:: error:: Error for Infallible { }
171
172
impl std:: fmt:: Display for Infallible {
172
173
#[ inline]
173
- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
174
- write ! ( f , "operation that can't fail just failed ")
174
+ fn fmt ( & self , _f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
175
+ unreachable ! ( "uninhabited enum ")
175
176
}
176
177
}
177
178
0 commit comments