[tor-bugs] #25639 [Core Tor/Tor]: think about Rust crate boundaries (was: merge Rust crates)

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Mar 27 16:38:59 UTC 2018


#25639: think about Rust crate boundaries
--------------------------+----------------------------------
 Reporter:  Hello71       |          Owner:  Hello71
     Type:  enhancement   |         Status:  assigned
 Priority:  High          |      Milestone:
Component:  Core Tor/Tor  |        Version:  Tor: unspecified
 Severity:  Normal        |     Resolution:
 Keywords:  rust          |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+----------------------------------
Changes (by Hello71):

 * status:  new => assigned
 * owner:  (none) => Hello71


Comment:

 Replying to [comment:1 nickm]:
 > (I'd like to know what the other rust people think here too)

 yeah, I meant this as kind of an RFC (that I was hoping there wouldn't be
 any objections to :P)

 Replying to [comment:2 chelseakomlo]:
 > I don't think is a good idea. I agree this makes it simpler in the short
 term but this won't scale well. I.e, we definitely want more modularity in
 Rust/new code, not less.
 >
 > Have you looked at how Servo handles this problem?
 https://github.com/servo/servo I think we should consult more Mozilla
 people about how they have handled issues like running tests, linking,
 etc.

 I will investigate. AIUI their situation is different though: servo is
 intended to be a fully enclosed module, if primarily intended for use in a
 single application, whereas in Tor we have tight coupling between
 everything. possibly we should consider having several distinct modules,
 but in that case we need to discuss how we draw those lines; if they're
 "everything depends on everything else" then it only causes problems to
 have them as separate crates, but if the dependencies are actually limited
 then it might make sense. oh, or if they've already been discussed, I
 think it needs to be better documented.

 doc/HACKING/CodingStandardsRust.md:
 > If your Rust code must call out to parts of Tor's C code, you must
 > declare the functions you are calling in the `external` crate, located
 > at `.../src/rust/external`.

 if this was actually followed, maybe we could use it for tests? not sure
 though.

 Replying to [comment:3 chelseakomlo]:
 > Have you looked at how building is handled in `tor_rust/lib.rs`?

 I think you mean `tor_rust/Cargo.toml`? Yeah, I understand how it works
 now, I just don't think it's a good system. I'm open to being convinced
 otherwise though.

 Replying to [comment:5 chelseakomlo]:
 > For more context about the Rust build structure, see:
 https://trac.torproject.org/projects/tor/ticket/22840#comment:11
 >
 > And how Gecko includes/builds Rust crates: https://github.com/mozilla
 /gecko-dev/blob/master/toolkit/library/rust/shared/lib.rs#L5-L24

 I will investigate.

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


More information about the tor-bugs mailing list