[tor-bugs] #22106 [Core Tor/Tor]: Initial Rust support

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed May 17 14:16:31 UTC 2017


#22106: Initial Rust support
--------------------------+------------------------------------
 Reporter:  Sebastian     |          Owner:
     Type:  defect        |         Status:  needs_review
 Priority:  Medium        |      Milestone:  Tor: 0.3.2.x-final
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:  rust          |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------

Comment (by tedmielczarek):

 Just for reference, in Firefox we decided to vendor our dependencies into
 our main repository using the `cargo vendor` command[1]. They're in
 `third_party/rust` in mozilla-central[2]. We added a `mach vendor rust`
 command to our mach build interface to run vendoring with the right
 parameters[3]. We do a number of checks there, including checking license
 compatibility of vendored crates and checking that we're not accidentally
 committing huge files contained in vendored crates. Our build system
 writes out a `.cargo/config` file[4] in the object directory after running
 configure that uses cargo source replacement[5] to point cargo at the
 directory containing vendored crates instead of crates.io. We then build
 our Rust code by passing `--frozen` to cargo[6], which ensures that cargo
 doesn't fetch anything from the network.

 One annoyance here is that this makes local development that adds new
 dependencies from crates.io a little more frustrating, as developers have
 to vendor new deps before building. We could omit `--frozen` in builds
 done outside of automation, but that would mean that developers would wind
 up with cargo fetching crates from crates.io when the crates they need are
 sitting right there in the repository, and that seems silly. I opened a
 cargo issue[7] a while ago to ask for some way to better support this
 workflow but I haven't pushed on getting it fixed.

 1. https://github.com/alexcrichton/cargo-vendor/
 2. https://dxr.mozilla.org/mozilla-central/source/third_party/rust
 3. https://dxr.mozilla.org/mozilla-
 central/rev/41958333867b0f537271dbd4cb4ba9e8a67a85a8/python/mozbuild/mozbuild/vendor_rust.py#276
 4. https://dxr.mozilla.org/mozilla-central/source/.cargo/config.in
 5. https://github.com/rust-lang/cargo/blob/master/src/doc/source-
 replacement.md
 6. https://dxr.mozilla.org/mozilla-
 central/rev/41958333867b0f537271dbd4cb4ba9e8a67a85a8/config/rules.mk#911
 7. https://github.com/rust-lang/cargo/issues/3066

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/22106#comment:19>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list