Using Rust in Mercurial

Pascal Quantin pascal.quantin at gmail.com
Wed Dec 6 20:39:14 UTC 2017


Hi Gregory,

2017-12-05 20:00 GMT+01:00 Gregory Szorc <gregory.szorc at gmail.com>:

> Mercurial Packagers,
>
> We would like to start using Rust in Mercurial. A brain dump is at
> https://www.mercurial-scm.org/wiki/OxidationPlan. The anticipated
> sequence of events is likely something like:
>
> 1) Replace exewrapper.c/hg.exe with a Rust binary on Windows
> 2) Rewrite existing C Python extensions in Rust
> 3) Make `hg` a Rust binary (instead of a Python script) on all platforms.
> This requires the Rust binary to link against libpython and embed a Python
> interpreter.
>
> There is no timeline for these milestones. But I'd like to do #1 in the
> 4.5 release if possible and #2 and #3 as soon as possible after that.
>
> The Mercurial Project itself is interested in shipping a
> self-contained/standalone Mercurial distribution. This would include its
> own bundled version of Python, including the standard library.
>
> When we start requiring Rust to use Mercurial, I anticipate that
> downstream packagers will want to package an "unbundled" Mercurial - one
> that links against the system libpython2.7 and uses the system Python's
> standard library. This is totally fine and shouldn't be difficult to
> support.
>
> My question to packagers is: what is your current level of support for a)
> Rust b) embedding CPython? e.g. what is the minimum version of Rust we can
> target? Do you support a shared libpython2.7.so or only a static
> libpython2.7.a?
>
> I'll likely capture replies on the aforementioned OxidationPlan wiki page.
> If you want to just add relevant info there (anywhere is fine - I'll see
> the wiki updates and refactor if needed), feel free to do that.
>
> I want to emphasize that nothing is yet set in stone. But adding Rust to
> Mercurial is something we would very much like to do and we would like to
> have as many packagers on board as possible.
>

I'm the maintainer of the Windows Inno Setup installers (both for x86 and
x64).
I have never used Rust myself, so it could be a good opportunity to
discover it a bit. I looked at
https://www.rust-lang.org/en-US/other-installers.html and saw that you can
install a MinGW based Rust both for x86 and x64.
FYI in Wireshark project, we are building many 3rd party libraries using
MinGW (that uses MSVCRT.dll availabel on all Windows platforms AFAIK) while
Wireshark itself is built with MSVC 2013/2015 (depending on the branches).
As long as the libraries have clean APIs to allocate / free memory using
the right C runtime, we did not face issues. It could be an alternative to
the static linking proposal done in
https://www.mercurial-scm.org/wiki/OxidationPlan.
The bad news for me is that my x86 build machine is still based on a very
ancient Windows XP virtual machine, and rustup-init.exe does not run on it.
It could be a good opportunity for me to reinstall a new build machine
though...

Best regards,
Pascal.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-packaging/attachments/20171206/ee9e65f9/attachment-0002.html>


More information about the Mercurial-packaging mailing list