Use `rure` instead of the `regex-ffi`
Categories
(Core :: XPCOM, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox107 | --- | fixed |
People
(Reporter: nika, Assigned: nika)
References
Details
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 |
While we already have an in-tree regex-ffi crate which provides basic access to the rust regex crate for use in FormAutofillNative, the regex crate itself provides and maintains its own c api as the rure crate in-tree (https://github.com/rust-lang/regex/tree/0d0023e412f7ead27b0809f5d2f95690d0f0eaef/regex-capi).
We should consider vendoring in rure to allow us to use the more-fully-featured official ffi, and migrate existing uses of regex-ffi to use it instead.
| Assignee | ||
Comment 1•3 years ago
|
||
While we already have an in-tree regex-ffi crate which provides basic
access to regex functionality for use in FormAutofillNative, the regex
crate itself provides and maintains its own c api as the rure crate.
This patch vendors in rure to allow us to use the more-fully-featured
official ffi.
Depends on D158872
| Assignee | ||
Comment 2•3 years ago
|
||
This makes the API more ergonomic to use from our c++ code, managing things
like lifecycles automatically.
Documentation comments are copied from the rure.h header, and modified
slightly to reflect the C++ types.
Depends on D158873
| Assignee | ||
Comment 3•3 years ago
|
||
The RustRegex wrapper is built on the official rure ffi bindings for the
regex crate, which was added in previous parts. The regex-ffi crate will be
removed in the next part.
Depends on D158874
| Assignee | ||
Comment 4•3 years ago
|
||
It is no longer necessary now that rure bindings are in use.
Depends on D158875
| Assignee | ||
Comment 5•3 years ago
|
||
This will make customizing flags on the regex type less error-prone, as passing
a flag (e.g. RustRegex::FLAG_CASEI) will not implicitly disable the default
UNICODE flag.
Names and comments were taken from the original RegexBuilder type in the
regex crate which this type is inspired by, and the type was changed to be
cheaply copyable and support method chaining, so that it can be used more
ergonomically.
Depends on D158874
Updated•3 years ago
|
Updated•3 years ago
|
Comment 7•3 years ago
|
||
Backed out for causing build bustages on RustRegex.h
- Backout link
- Push with failures
- Failure Log
- Failure line: /builds/worker/workspace/obj-build/dist/include/mozilla/RustRegex.h:630:24: error: unused variable 'view' [-Werror,-Wunused-variable]
Log tier 2: https://treeherder.mozilla.org/logviewer?job_id=392996025&repo=autoland
Comment 9•3 years ago
•
|
||
Backed out for causing build bustages
- Backout link
- Push with failures
- Failure Log
- Failure line: clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[4]: *** [/builds/worker/checkouts/gecko/config/makefiles/rust.mk:433: force-cargo-library-build] Error 101
And xpcshell failures: https://treeherder.mozilla.org/logviewer?job_id=393044321&repo=autoland
| Assignee | ||
Comment 10•3 years ago
|
||
Cargo will attempt to build all targets for dependencies, and there
appears to be no option to turn that functionality off (see
https://github.com/rust-lang/cargo/issues/11232). If we try to build the
rure crate as a cdylib during a PGO build, it causes linker issues,
which make the build fail. As this artifact isn't necessary for our
build, we can patch the crate to remove the cdylib and staticlib
crate-type definitions, making the build pass as only the artifact we
need is built.
Depends on D158876
Comment 11•3 years ago
|
||
Comment 12•3 years ago
|
||
| Assignee | ||
Updated•3 years ago
|
Comment 13•3 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/54ecd33212a9
https://hg.mozilla.org/mozilla-central/rev/2533ff4898b3
https://hg.mozilla.org/mozilla-central/rev/0e4aa3c8da14
https://hg.mozilla.org/mozilla-central/rev/69586ab16a36
https://hg.mozilla.org/mozilla-central/rev/24e8f8b9b759
https://hg.mozilla.org/mozilla-central/rev/59a66b8852f5
Description
•