Closed Bug 1325073 Opened 9 years ago Closed 8 years ago

Make a shorter version for constructing error values of Result<V,E>

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: nbp, Assigned: nbp)

Details

Attachments

(1 file)

To construct an error value today, we have to use either the constructor of the Result<V,E>, or to use the GenericErrorResult<E>. In IonBuilder (Bug 1286505) we have multiple Ok types, but a single generic error type, in which case making such error is made verbose by the function mozilla::MakeGenericErrorResult I suggest to rename this function to mozilla::Err In order to follow the same naming as Rust code, and in the continuity of the Ok() constructor.
Assignee: nobody → nicolas.b.pierron
Status: NEW → ASSIGNED
Comment on attachment 8820717 [details] [diff] [review] Rename mozilla::MakeGenericErrorResult to mozilla::Err. Review of attachment 8820717 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit/Ion.h @@ +40,5 @@ > > template <typename V> > using AbortReasonOr = mozilla::Result<V, AbortReason>; > using mozilla::Ok; > +using mozilla::Err; This should go before Ok for alphabetical purposes. ::: mfbt/tests/TestResult.cpp @@ +6,5 @@ > > #include "mozilla/Result.h" > > using mozilla::GenericErrorResult; > +using mozilla::Err; E before G, so move this one line earlier.
Attachment #8820717 - Flags: review?(jwalden+bmo) → review+
Pushed by npierron@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/3ec4fd0c06c9 Rename mozilla::MakeGenericErrorResult to mozilla::Err. r=Waldo
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: