@@ -121,7 +121,7 @@ pub unsafe trait UserData: Sized + Clone {
121121
122122/// Trait for wrappers that can be mapped immutably.
123123pub trait Map : UserData {
124- type Err : Debug ;
124+ type Err : std :: error :: Error ;
125125
126126 /// Maps a `&T` to `U`. Called for methods that take `&self`.
127127 ///
@@ -134,7 +134,7 @@ pub trait Map: UserData {
134134
135135/// Trait for wrappers that can be mapped mutably.
136136pub trait MapMut : UserData {
137- type Err : Debug ;
137+ type Err : std :: error :: Error ;
138138
139139 /// Maps a `&mut T` to `U`. Called for methods that take `&mut self`.
140140 ///
@@ -147,7 +147,7 @@ pub trait MapMut: UserData {
147147
148148/// Trait for wrappers that can be mapped once.
149149pub trait MapOwned : UserData {
150- type Err : Debug ;
150+ type Err : std :: error :: Error ;
151151
152152 /// Maps a `T` to `U`. Called for methods that take `self`. This method may fail with
153153 /// an error if it is called more than once on the same object.
@@ -168,10 +168,11 @@ pub type DefaultUserData<T> = LocalCellData<T>;
168168#[ allow( clippy:: exhaustive_enums) ] // explicitly uninhabited
169169pub enum Infallible { }
170170
171+ impl std:: error:: Error for Infallible { }
171172impl std:: fmt:: Display for Infallible {
172173 #[ 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 ")
175176 }
176177}
177178
0 commit comments