Skip to content

Commit f6a833a

Browse files
committed
Suggest alternatives to Error::description()
1 parent a5655b8 commit f6a833a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libstd/error.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ pub trait Error: Debug + Display {
5858
/// new code should use [`Display`] instead
5959
/// and new `impl`s can omit it.
6060
///
61+
/// To obtain error description as a string, use `to_string()`.
62+
///
6163
/// [`Display`]: ../fmt/trait.Display.html
6264
///
6365
/// # Examples
@@ -73,7 +75,7 @@ pub trait Error: Debug + Display {
7375
/// ```
7476
#[stable(feature = "rust1", since = "1.0.0")]
7577
fn description(&self) -> &str {
76-
""
78+
"description() is deprecated; use Display"
7779
}
7880

7981
/// The lower-level cause of this error, if any.

0 commit comments

Comments
 (0)