Simplify the errors used in mozilla::intl APIs, and ensure they pack nicely in a Result
Categories
(Core :: Internationalization, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox94 | --- | fixed |
People
(Reporter: gregtatum, Assigned: gregtatum)
References
Details
(Whiteboard: [i18n-unification])
Attachments
(6 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Currently there is lots of duplication in the error types returned by the unified intl APIs. We should take a pass across the components and unify them into a simpler set. In addition, we should try and ensure that we don't need to use the ResultVariant.h file. I filed these two bugs together because they seem like they could be handled in a single pass.
per anba:
Packed-variant selection happens here.
class DateTimeFormat final {
// ...
// Start error values at 1 to allow using the UnusedZero Result optimization.
enum class StyleError { DateFormatFailure = 1 };
// ...
};
namespace mozilla::detail {
template <>
struct UnusedZero<DateTimeFormat::StyleError> : UnusedZeroEnum<DateTimeFormat::StyleError> {};
}
Comment 1•3 years ago
|
||
We should also make sure the errors are defined in a separate header, and remove the error definitions from ICU4CGlue.h, since this work may outlive our use of ICU4C.
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 2•3 years ago
|
||
I don't think we can get rid of the ResultVariant.h. In order to be a PackedVariant, it must fit into:
struct VEbool {
V v;
E e;
bool ok;
};
struct EVbool {
E e;
V v;
bool ok;
};
Such that sizeof the struct is less than uintptr_t
.
Assignee | ||
Comment 3•3 years ago
|
||
Assignee | ||
Comment 4•3 years ago
|
||
Depends on D124959
Assignee | ||
Comment 5•3 years ago
|
||
Depends on D124960
Assignee | ||
Comment 6•3 years ago
|
||
Depends on D124961
Assignee | ||
Comment 7•3 years ago
|
||
This is a drive-by clean-up while I'm working on errors.
Depends on D124962
Assignee | ||
Comment 8•3 years ago
|
||
Depends on D124963
Pushed by gtatum@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3b74133ec371 Use ICUError in mozilla::intl::Calendar; r=platform-i18n-reviewers,dminor https://hg.mozilla.org/integration/autoland/rev/7a671d2ad4f4 Use ICUError in mozilla::intl::DateTimePatternGenerator; r=platform-i18n-reviewers,dminor https://hg.mozilla.org/integration/autoland/rev/0791afd78546 Use ICUError in mozilla::intl::PluralRules; r=platform-i18n-reviewers,dminor https://hg.mozilla.org/integration/autoland/rev/8490468f29bf Add missing ICUError.h headers; r=platform-i18n-reviewers,dminor https://hg.mozilla.org/integration/autoland/rev/1ca14b3b9c6e Flatten nested namespaces in mozilla::intl components; r=platform-i18n-reviewers,dminor https://hg.mozilla.org/integration/autoland/rev/8b89cbf78dfd Propagate ICU statuses to ICUErrors; r=platform-i18n-reviewers,dminor
Comment 10•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3b74133ec371
https://hg.mozilla.org/mozilla-central/rev/7a671d2ad4f4
https://hg.mozilla.org/mozilla-central/rev/0791afd78546
https://hg.mozilla.org/mozilla-central/rev/8490468f29bf
https://hg.mozilla.org/mozilla-central/rev/1ca14b3b9c6e
https://hg.mozilla.org/mozilla-central/rev/8b89cbf78dfd
Description
•