THRIFT-5360 Remove deprecated Error::description() methods (#2342)
Client: rs
diff --git a/lib/rs/README.md b/lib/rs/README.md
index 1e10e35..30e36d4 100644
--- a/lib/rs/README.md
+++ b/lib/rs/README.md
@@ -48,6 +48,90 @@
##### Thrift 0.15.0
+* **[THRIFT-5360]** - No longer define OR generate `description()` methods for `Error` types.
+
+ `Error.description()` was soft-deprecated in 1.27, and deprecated as of 1.41.
+ Library error types also do not implement `Error.description()`. Also, as a result of this change
+ the generated Rust representation of an Error no longer implements the `Error.description()` method.
+ Instead, it generates a `Display` impl with the same information.
+
+ For example:
+
+ ```thrift
+ exception Xception {
+ 1: i32 errorCode,
+ 2: string message
+ }
+ ```
+
+ used to generate:
+
+ ```rust
+ use std::error::Error;
+ use std::fmt;
+ use std::fmt::{Display, Formatter};
+
+ // auto-generated by the Thrift compiler
+ #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
+ pub struct Xception {
+ pub error_code: Option<i32>,
+ pub message: Option<String>,
+ }
+
+ // auto-generated by the Thrift compiler
+ impl Error for Xception {
+ fn description(&self) -> &str {
+ "remote service threw Xception"
+ }
+ }
+
+ // auto-generated by the Thrift compiler
+ impl From<Xception> for thrift::Error {
+ fn from(e: Xception) -> Self {
+ thrift::Error::User(Box::new(e))
+ }
+ }
+
+ // auto-generated by the Thrift compiler
+ impl Display for Xception {
+ fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ self.description().format(f)
+ }
+ }
+ ```
+
+ It *now* generates:
+
+ ```rust
+ use std::error::Error;
+ use std::fmt;
+ use std::fmt::{Display, Formatter};
+
+ // auto-generated by the Thrift compiler
+ #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
+ pub struct Xception {
+ pub error_code: Option<i32>,
+ pub message: Option<String>,
+ }
+
+ // auto-generated by the Thrift compiler
+ impl Error for Xception { }
+
+ // auto-generated by the Thrift compiler
+ impl From<Xception> for thrift::Error {
+ fn from(e: Xception) -> Self {
+ thrift::Error::User(Box::new(e))
+ }
+ }
+
+ // auto-generated by the Thrift compiler
+ impl Display for Xception {
+ fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ write!(f, "remote service threw Xception")
+ }
+ }
+ ```
+
* **[THRIFT-5314]** - Generate enums implementations that are forward compatible (i.e. don't error on unknown values)
As a result of this change the Rust representation of an enum changes from a standard