Closed
Bug 1850723
Opened 2 years ago
Closed 2 years ago
Add mozilla::Result<V1, E> constructor that receives mozilla::Result<V2, E> where V2 is subclass of V1
Categories
(Core :: MFBT, enhancement)
Core
MFBT
Tracking
()
RESOLVED
FIXED
121 Branch
| Tracking | Status | |
|---|---|---|
| firefox121 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(1 file)
|
Bug 1850723 - Make mozilla::Result constructor take another result with convertible value. r?emilio!
48 bytes,
text/x-phabricator-request
|
Details | Review |
mozilla::Result has the following constructor, which receives different mozilla::Result with convertible error.
Having the same for value type helps using it in bug 1849732 where value type is pointer and it can be subclass.
/**
* Create a (success/error) result from another (success/error) result with a
* different but convertible error type. */
template <typename E2,
typename = std::enable_if_t<std::is_convertible_v<E2, E>>>
MOZ_IMPLICIT constexpr Result(Result<V, E2>&& aOther)
: mImpl(aOther.isOk() ? Impl{aOther.unwrap()}
: Impl{aOther.unwrapErr()}) {}
| Assignee | ||
Comment 1•2 years ago
|
||
this can be restricted to bug 1850710's case if necessary.
See Also: → 1850710
| Assignee | ||
Comment 2•2 years ago
|
||
Also add std::in_place_t constructor to make the in-place constructor works.
Depends on D191537
Updated•2 years ago
|
Attachment #9359599 -
Attachment description: WIP: Bug 1850723 - Add mozilla::Result constructor which takes another result with convertible value. → WIP: Bug 1850723 - Add mozilla::Result constructor which takes another result with convertible value. r?emilio!
Updated•2 years ago
|
Attachment #9359599 -
Attachment description: WIP: Bug 1850723 - Add mozilla::Result constructor which takes another result with convertible value. r?emilio! → Bug 1850723 - Add mozilla::Result constructor which takes another result with convertible value. r?emilio!
Updated•2 years ago
|
Attachment #9359599 -
Attachment description: Bug 1850723 - Add mozilla::Result constructor which takes another result with convertible value. r?emilio! → Bug 1850723 - Make mozilla::Result constructor take another result with convertible value. r?emilio!
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/7398cacb1ad3
Make mozilla::Result constructor take another result with convertible value. r=emilio,glandium
Comment 4•2 years ago
|
||
Backed out for causing failures on mfbt/tests/TestResult.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/e8cea1e9bd584b4a98fb919ab50f3e997b4d5d14
Flags: needinfo?(arai.unmht)
| Assignee | ||
Updated•2 years ago
|
Flags: needinfo?(arai.unmht)
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/b8d7ddef8a12
Make mozilla::Result constructor take another result with convertible value. r=emilio,glandium
Comment 6•2 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
status-firefox121:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•