Page MenuHomePhabricator

hg-core: add configparser to library
Needs ReviewPublic

Authored by indygreg on Dec 7 2019, 3:17 PM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

This commit contains all the changes to the recently-imported
Rust code to make it work with our Rust library and pass our
linting tests.

We rename lib.rs to mod.rs to reflect it being a sub-module instead
of a full library. We add this module to our lib.rs. We add various
package dependencies to Cargo.toml. We make a handful of Rust code
updates to reflect the new symbol locations. Finally, we add a
parser.rs containing the boilerplate for generating a config file
parser from the spec.pest file.

As part of adding the dependencies, some versions changed slightly
from the upstream Cargo.toml, as we already had referenced a more
modern crate version.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

indygreg created this revision.Dec 7 2019, 3:17 PM
Alphare added a subscriber: Alphare.Dec 9 2019, 8:00 AM
Alphare added inline comments.
rust/hg-core/Cargo.toml
19

"The current minimum required Rust version is 1.36". This disqualifies this crate from being used in hg-core right now. Good news is that it is supposed to offer improvements over existing std types like Mutex and the like, so it's nothing that would be hard to replace.

Also, I've seen complaints online about the lack of benchmarks of parking_lot against std types to back-up their claims for performance. I have not looked into it myself.

Alphare added inline comments.Dec 12 2019, 3:48 AM
rust/hg-core/Cargo.toml
14

I wonder about this dependency. It uses 4 usize for every slice of bytes, and adds some overhead, albeit minimal, that I am trying to justify.
Are we looking at reaping the benefits down the line? The crate itself is good quality, maintained by the Tokio people, so I'm not *too* worried about it being pre-1.0, but do we need this?

Alphare added inline comments.Dec 12 2019, 2:57 PM
rust/hg-core/Cargo.toml
14

I know it doesn't matter at all, but the timing of this issue is just too funny not to share: https://github.com/tokio-rs/bytes/issues/340

I'm a little lost on the state of this. It looks like we need to downgrade the required Rust version?