BurntSushi / regex-automata

A low level regular expression library that uses deterministic finite automata.
The Unlicense
351 stars 26 forks source link

Minimizing dependencies #12

Closed workingjubilee closed 1 year ago

workingjubilee commented 3 years ago

Hello,

I have been trying to reduce the number of dependencies for rustc, because while it is natural to expect something like rustc to have a big download and compile, that makes it all the more important to trim out dependencies where we can. It's especially important because of things like the rustc workspace hack. Accordingly, I have been factoring Rust and its dependencies to use Rust std methods, which includes {to,from}_{be,le,ne}_bytes, stabilized in 1.32 (and made const fn in 1.44)... so, in most cases, removing your byteorder crate.

Currently, byteorder is still in rustc because regex-automata is being used by matchers which is used in tracing-subscriber which is used in tracing which is used for logging in rustc.

I was wondering if you would accept a PR to factor out byteorder from regex-automata? I know it implies a Minimum Supported Rust Version bump, and while I can't find an explicit note for the MSRV for this library, I know it is quite low, which is why I wanted to ask first and understand your stance.

BurntSushi commented 3 years ago

Yeah this would be okay. I do have a WIP rewrite of this crate that removes byteorder (although it does add memchr).

I don't think it would be worth trying to adapt the changes in my WIP branch back into master since a lot has changed. I think just trying to find the change that makes sense for master would be best.

But yeah, totally okay with an MSRV bump here.

And TIL regex-automata was used in rustc.

workingjubilee commented 3 years ago

Yup! fst is used in rls-analysis, and regex is used extensively throughout rustc and its tooling. And your ignore crate appears in cargo, bootstrap, and rustfmt, which includes globset, which includes aho-corasick, which is used in the jsonrpc framework that RLS depends on!

BurntSushi commented 3 years ago

Oh wow, that's really cool! I didn't know some of that. :-)

Also, sorry I didn't mention this before, but it will probably be some time before the WIP branch is merged into master. I'd like to say "months," but I think "1 year" is more likely. :-/ So if you want to drop byteorder sooner rather than later, it probably doesn't make sense to wait for that branch to land.

workingjubilee commented 3 years ago

I will probably get around to submitting a patch sometime this week. 💖 Shouldn't take much.

BurntSushi commented 1 year ago

This was done. And regex-automata has zero required dependencies now.