diff options
| author | Sean Chen <seanchen11235@gmail.com> | 2021-10-22 13:47:05 -0500 |
|---|---|---|
| committer | Sean Chen <seanchen11235@gmail.com> | 2021-10-22 13:47:05 -0500 |
| commit | c6de41331c732a8f70088ceab12a5049e3db0caa (patch) | |
| tree | c0d25d5c03a7fea6bcdb2d29215448c7bbfa6ed5 /library/std/src | |
| parent | 6a59d0e3aa26543fc4d3eaae1fa4cd48522045d2 (diff) | |
| download | rust-c6de41331c732a8f70088ceab12a5049e3db0caa.tar.gz rust-c6de41331c732a8f70088ceab12a5049e3db0caa.zip | |
Change `source` field to `error`
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/error.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/library/std/src/error.rs b/library/std/src/error.rs index 5988075836d..52f3ebbdee4 100644 --- a/library/std/src/error.rs +++ b/library/std/src/error.rs @@ -857,7 +857,7 @@ impl dyn Error + Send + Sync { /// ``` #[unstable(feature = "error_reporter", issue = "90172")] pub struct Report<E> { - source: E, + error: E, show_backtrace: bool, pretty: bool, } @@ -868,8 +868,8 @@ where { /// Create a new `Report` from an input error. #[unstable(feature = "error_reporter", issue = "90172")] - pub fn new(source: E) -> Report<E> { - Report { source, show_backtrace: false, pretty: false } + pub fn new(error: E) -> Report<E> { + Report { error, show_backtrace: false, pretty: false } } /// Enable pretty-printing the report. @@ -889,9 +889,9 @@ where /// Format the report as a single line. #[unstable(feature = "error_reporter", issue = "90172")] fn fmt_singleline(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.source)?; + write!(f, "{}", self.error)?; - let sources = self.source.source().into_iter().flat_map(<dyn Error>::chain); + let sources = self.error.source().into_iter().flat_map(<dyn Error>::chain); for cause in sources { write!(f, ": {}", cause)?; @@ -903,7 +903,7 @@ where /// Format the report as multiple lines, with each error cause on its own line. #[unstable(feature = "error_reporter", issue = "90172")] fn fmt_multiline(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let error = &self.source; + let error = &self.error; write!(f, "{}", error)?; @@ -950,8 +950,8 @@ impl<E> From<E> for Report<E> where E: Error, { - fn from(source: E) -> Self { - Report::new(source) + fn from(error: E) -> Self { + Report::new(error) } } |
