`wrapping_sub()`-based high surrogate check was off by one due to
error in copy and paste when defining the constant to compare against.
That is, the subtraction that defines the constant was completely wrong
but the result of the subtraction was only off by one, which is why the
bug wasn't discovered immediately. This lead to the first low surrogate
(U+DC00), and only the first low surrogate, getting accepted as a high
surrogate.
Discovered using cargo-fuzz.
MozReview-Commit-ID: K3Ptws31WuV
The easy part of this patch is the addition of the RustTest itself.
The more difficult to understand part of the patch is the changes to all
of our Rust build configuration. We do this due to a bug in cargo:
https://github.com/rust-lang/cargo/issues/3923
where features on dependent crates are not correctly taken into account
when determining whether cached artifacts on disk are valid and whether
they should be evicted from the disk cache. The practical upshot of
this behavior is that, say, running gtests during normal development
when files in libxul are modified will:
* rebuild some Rust dependencies for libxul;
* link libxul;
* rebuild those same Rust dependencies *again* for libxul-gtest, since
we have different features active and therefore the old artifacts look
to be out of date;
* link libxul-gtest.
Needless to say, this is highly annoying and counterproductive behavior.
The "fix" is to ensure that the gkrust-shared crate explicitly depends
on crates and assigns features to them such that the feature sets do not
change between normal builds and testing builds. This is admittedly
fragile, but it is not the first time this has come up, and is probably
not the last.
The runloop seems like a good candidate for moving into its own crate.
I wasn't sure whether we want it under the Mozilla org on GitHub, so I pushed
it to ttaubert/rust-runloop for a start. Moving the repository to mozilla/*
is easy, and we'd just need to bump the crate version with the updated
repository, if you think we should.
Bug #: 1400559
Differential Revision: https://phabricator.services.mozilla.com/D62