-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Implement Error::source on IntoStringError + Remove superfluous cause impls #65366
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
IntoStringError only implemented Error::cause, which is deprecated. This implemements Error::source instead. Error::cause will still work as before, thanks to the default implementation.
(rust_highfive has picked a reviewer for you, use r? to override) |
This guess was wrong. |
Pushed two more commits. Removing |
src/libstd/io/error.rs
Outdated
Repr::Os(..) => None, | ||
Repr::Simple(..) => None, | ||
Repr::Custom(ref c) => c.error.cause(), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This risks being a noticeable change since we are calling out to a user-supplied .cause() vs .source() here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I almost expected there was some aspect of this I missed 😅
I removed the last commit.
9c00e07
to
b8e7f76
Compare
@bors r+ rollup Thanks! |
📌 Commit b8e7f76 has been approved by |
…bluss Implement Error::source on IntoStringError + Remove superfluous cause impls IntoStringError only implemented `Error::cause`, which is deprecated. This implemements `Error::source` instead. `Error::cause` will still work as before, thanks to the default implementation. I think this was the only/last `Error` impl in the standard library to have a cause, but not a source.
…bluss Implement Error::source on IntoStringError + Remove superfluous cause impls IntoStringError only implemented `Error::cause`, which is deprecated. This implemements `Error::source` instead. `Error::cause` will still work as before, thanks to the default implementation. I think this was the only/last `Error` impl in the standard library to have a cause, but not a source.
Rollup of 10 pull requests Successful merges: - #65214 (Split non-CAS atomic support off into target_has_atomic_load_store) - #65246 (vxWorks: implement get_path() and get_mode() for File fmt::Debug) - #65312 (improve performance of signed saturating_mul) - #65336 (Fix typo in task::Waker) - #65346 (nounwind tests and cleanup) - #65347 (Fix #[unwind(abort)] with Rust ABI) - #65366 (Implement Error::source on IntoStringError + Remove superfluous cause impls) - #65369 (Don't discard value names when using address or memory sanitizer) - #65370 (Add `dyn` to `Any` documentation) - #65373 (Fix typo in docs for `Rc`) Failed merges: r? @ghost
IntoStringError only implemented
Error::cause
, which is deprecated. This implemementsError::source
instead.Error::cause
will still work as before, thanks to the default implementation.I think this was the only/last
Error
impl in the standard library to have a cause, but not a source.