Add Result<Result<T, E>, E>::flatten -> Result<T, E>#70140
Add Result<Result<T, E>, E>::flatten -> Result<T, E>#70140bors merged 1 commit intorust-lang:masterfrom
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
| } | ||
|
|
||
| impl<T, E> Result<Result<T, E>, E> { | ||
| /// Converts from `Result<Result<T, E>, E>` to `Result<T, E>` |
There was a problem hiding this comment.
I think the documentation could be reworded a bit, to emphasize what happens if one of the results is an Err variant (which wasn't really needed for Option<T>::flatten). It should be noted that, in Rustdoc, you don't directly see the type of self when looking at the definition of a method.
|
Should this possibly also convert the error type like the try operator does? |
|
r? @Amanieu |
|
It seems strange to me that an operation named |
|
@bors r+ rollup |
|
📌 Commit 6fe7867 has been approved by |
Rollup of 3 pull requests Successful merges: - rust-lang#70140 (Add Result<Result<T, E>, E>::flatten -> Result<T, E>) - rust-lang#70526 (reduce `rustc_attr` usage in places) - rust-lang#70527 (Update LLVM submodule) Failed merges: r? @ghost
…atten, r=jhpratt Stabilize feature `result_flattening` Stabilizes the `Result::flatten` method ## Implementations - [x] Implementation `Result::flatten`: rust-lang#70140 - [x] Implementation `const` `Result::flatten`: rust-lang#130692 - [x] Update stabilization attribute macros (this PR) ## Stabilization process - [x] Created this PR [suggested](rust-lang#70142 (comment)) by `@RalfJung` - [x] FCP (haven't found any, is it applicable here?) - [ ] Close issue rust-lang#70142
…atten, r=jhpratt Stabilize feature `result_flattening` Stabilizes the `Result::flatten` method ## Implementations - [x] Implementation `Result::flatten`: rust-lang#70140 - [x] Implementation `const` `Result::flatten`: rust-lang#130692 - [x] Update stabilization attribute macros (this PR) ## Stabilization process - [x] Created this PR [suggested](rust-lang#70142 (comment)) by ``@RalfJung`` - [x] FCP (haven't found any, is it applicable here?) - [ ] Close issue rust-lang#70142
Rollup merge of #141072 - Rynibami:stabilize-const-result-flatten, r=jhpratt Stabilize feature `result_flattening` Stabilizes the `Result::flatten` method ## Implementations - [x] Implementation `Result::flatten`: #70140 - [x] Implementation `const` `Result::flatten`: #130692 - [x] Update stabilization attribute macros (this PR) ## Stabilization process - [x] Created this PR [suggested](#70142 (comment)) by ``@RalfJung`` - [x] FCP (haven't found any, is it applicable here?) - [ ] Close issue #70142
…jhpratt Stabilize feature `result_flattening` Stabilizes the `Result::flatten` method ## Implementations - [x] Implementation `Result::flatten`: rust-lang/rust#70140 - [x] Implementation `const` `Result::flatten`: rust-lang/rust#130692 - [x] Update stabilization attribute macros (this PR) ## Stabilization process - [x] Created this PR [suggested](rust-lang/rust#70142 (comment)) by ``@RalfJung`` - [x] FCP (haven't found any, is it applicable here?) - [ ] Close issue rust-lang/rust#70142
…atten, r=jhpratt Stabilize feature `result_flattening` Stabilizes the `Result::flatten` method ## Implementations - [x] Implementation `Result::flatten`: rust-lang#70140 - [x] Implementation `const` `Result::flatten`: rust-lang#130692 - [x] Update stabilization attribute macros (this PR) ## Stabilization process - [x] Created this PR [suggested](rust-lang#70142 (comment)) by ``@RalfJung`` - [x] FCP (haven't found any, is it applicable here?) - [ ] Close issue rust-lang#70142
…jhpratt Stabilize feature `result_flattening` Stabilizes the `Result::flatten` method ## Implementations - [x] Implementation `Result::flatten`: rust-lang/rust#70140 - [x] Implementation `const` `Result::flatten`: rust-lang/rust#130692 - [x] Update stabilization attribute macros (this PR) ## Stabilization process - [x] Created this PR [suggested](rust-lang/rust#70142 (comment)) by ``@RalfJung`` - [x] FCP (haven't found any, is it applicable here?) - [ ] Close issue rust-lang/rust#70142
This PR makes this possible (modulo type inference):
Tracking issue: #70142
largely cribbed directly from #60256