File tree Expand file tree Collapse file tree 5 files changed +18
-12
lines changed Expand file tree Collapse file tree 5 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 82
82
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
83
83
84
84
use prelude:: * ;
85
- use fmt:: Display ;
85
+ use fmt:: { Debug , Display } ;
86
86
87
87
/// Base functionality for all errors in Rust.
88
- #[ unstable( feature = "core" ,
89
- reason = "the exact API of this trait may change" ) ]
90
- pub trait Error : Display {
91
- /// A short description of the error; usually a static string.
88
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
89
+ pub trait Error : Debug + Display + Send {
90
+ /// A short description of the error.
91
+ ///
92
+ /// The description should not contain newlines or sentence-ending
93
+ /// punctuation, to facilitate embedding in larger user-facing
94
+ /// strings.
95
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
92
96
fn description ( & self ) -> & str ;
93
97
94
98
/// The lower-level cause of this error, if any.
99
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
95
100
fn cause ( & self ) -> Option < & Error > { None }
96
101
}
97
102
Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ impl<W> FromError<IntoInnerError<W>> for Error {
258
258
}
259
259
260
260
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
261
- impl < W > error:: Error for IntoInnerError < W > {
261
+ impl < W : Send + fmt :: Debug > error:: Error for IntoInnerError < W > {
262
262
fn description ( & self ) -> & str {
263
263
error:: Error :: description ( self . error ( ) )
264
264
}
Original file line number Diff line number Diff line change @@ -977,7 +977,7 @@ impl<T> fmt::Display for SendError<T> {
977
977
}
978
978
979
979
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
980
- impl < T > error:: Error for SendError < T > {
980
+ impl < T : Send > error:: Error for SendError < T > {
981
981
982
982
fn description ( & self ) -> & str {
983
983
"sending on a closed channel"
@@ -1013,7 +1013,7 @@ impl<T> fmt::Display for TrySendError<T> {
1013
1013
}
1014
1014
1015
1015
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1016
- impl < T > error:: Error for TrySendError < T > {
1016
+ impl < T : Send > error:: Error for TrySendError < T > {
1017
1017
1018
1018
fn description ( & self ) -> & str {
1019
1019
match * self {
Original file line number Diff line number Diff line change @@ -105,11 +105,11 @@ impl<T> fmt::Debug for PoisonError<T> {
105
105
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
106
106
impl < T > fmt:: Display for PoisonError < T > {
107
107
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
108
- self . description ( ) . fmt ( f)
108
+ "poisoned lock: another task failed inside" . fmt ( f)
109
109
}
110
110
}
111
111
112
- impl < T > Error for PoisonError < T > {
112
+ impl < T : Send > Error for PoisonError < T > {
113
113
fn description ( & self ) -> & str {
114
114
"poisoned lock: another task failed inside"
115
115
}
@@ -161,13 +161,13 @@ impl<T> fmt::Debug for TryLockError<T> {
161
161
}
162
162
163
163
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
164
- impl < T > fmt:: Display for TryLockError < T > {
164
+ impl < T : Send > fmt:: Display for TryLockError < T > {
165
165
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
166
166
self . description ( ) . fmt ( f)
167
167
}
168
168
}
169
169
170
- impl < T > Error for TryLockError < T > {
170
+ impl < T : Send > Error for TryLockError < T > {
171
171
fn description ( & self ) -> & str {
172
172
match * self {
173
173
TryLockError :: Poisoned ( ref p) => p. description ( ) ,
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ pub type CommandError = Box<Error + 'static>;
20
20
pub type CommandResult < T > = Result < T , CommandError > ;
21
21
22
22
pub fn err ( s : & str ) -> CliError {
23
+ #[ derive( Debug ) ]
23
24
struct E ( String ) ;
24
25
25
26
impl Error for E {
You can’t perform that action at this time.
0 commit comments