Skip to content

Commit b8b9a0f

Browse files
Rollup merge of rust-lang#67561 - euclio:remove-description, r=jonas-schievink
remove `description` from `Error` impls in docs Since `description` is soft-deprecated, there's no need to show it implemented in these examples.
2 parents 8a1015f + 24f3dcf commit b8b9a0f

File tree

2 files changed

+5
-31
lines changed

2 files changed

+5
-31
lines changed

src/libstd/error.rs

+4-28
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ pub trait Error: Debug + Display {
9191
/// }
9292
///
9393
/// impl Error for SuperError {
94-
/// fn description(&self) -> &str {
95-
/// "I'm the superhero of errors"
96-
/// }
97-
///
9894
/// fn cause(&self) -> Option<&dyn Error> {
9995
/// Some(&self.side)
10096
/// }
@@ -109,11 +105,7 @@ pub trait Error: Debug + Display {
109105
/// }
110106
/// }
111107
///
112-
/// impl Error for SuperErrorSideKick {
113-
/// fn description(&self) -> &str {
114-
/// "I'm SuperError side kick"
115-
/// }
116-
/// }
108+
/// impl Error for SuperErrorSideKick {}
117109
///
118110
/// fn get_super_error() -> Result<(), SuperError> {
119111
/// Err(SuperError { side: SuperErrorSideKick })
@@ -159,10 +151,6 @@ pub trait Error: Debug + Display {
159151
/// }
160152
///
161153
/// impl Error for SuperError {
162-
/// fn description(&self) -> &str {
163-
/// "I'm the superhero of errors"
164-
/// }
165-
///
166154
/// fn source(&self) -> Option<&(dyn Error + 'static)> {
167155
/// Some(&self.side)
168156
/// }
@@ -177,11 +165,7 @@ pub trait Error: Debug + Display {
177165
/// }
178166
/// }
179167
///
180-
/// impl Error for SuperErrorSideKick {
181-
/// fn description(&self) -> &str {
182-
/// "I'm SuperError side kick"
183-
/// }
184-
/// }
168+
/// impl Error for SuperErrorSideKick {}
185169
///
186170
/// fn get_super_error() -> Result<(), SuperError> {
187171
/// Err(SuperError { side: SuperErrorSideKick })
@@ -261,11 +245,7 @@ impl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a> {
261245
/// }
262246
/// }
263247
///
264-
/// impl Error for AnError {
265-
/// fn description(&self) -> &str {
266-
/// "Description of an error"
267-
/// }
268-
/// }
248+
/// impl Error for AnError {}
269249
///
270250
/// let an_error = AnError;
271251
/// assert!(0 == mem::size_of_val(&an_error));
@@ -300,11 +280,7 @@ impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync +
300280
/// }
301281
/// }
302282
///
303-
/// impl Error for AnError {
304-
/// fn description(&self) -> &str {
305-
/// "Description of an error"
306-
/// }
307-
/// }
283+
/// impl Error for AnError {}
308284
///
309285
/// unsafe impl Send for AnError {}
310286
///

src/libstd/io/error.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,7 @@ impl Error {
402402
/// }
403403
/// }
404404
///
405-
/// impl error::Error for MyError {
406-
/// fn description(&self) -> &str { &self.v }
407-
/// }
405+
/// impl error::Error for MyError {}
408406
///
409407
/// impl Display for MyError {
410408
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

0 commit comments

Comments
 (0)