[tor-bugs] #25628 [Core Tor/Tor]: Document our Rust coding standards for error/failure types

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Aug 10 01:39:12 UTC 2018


#25628: Document our Rust coding standards for error/failure types
-------------------------------------------------+-------------------------
 Reporter:  isis                                 |          Owner:  (none)
     Type:  enhancement                          |         Status:  new
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  unspecified
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  rust, tor-doc, 034-triage-20180328,  |  Actual Points:
  034-removed-20180328                           |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:
                                                 |  Sponsor8-can
-------------------------------------------------+-------------------------

Old description:

> Every crate which returns `Result<T, E>`s or `Option<T>` anywhere in its
> public interface should have an `errors.rs` module containing error types
> which implement either `Display` or `Debug`, and also `::failure::Fail`
> for making errors easier to work with between crates. See the `errors.rs`
> addition to the `protover` crate from #24031 for an example (doesn't have
> the `::failure::Fail` impl yet, because the failure crate is about to
> become 1.0.0 any day now).
>
> We should probably wait on this until failure is 1.0.0.

New description:

 Every crate which returns `Result<T, E>`s or `Option<T>` anywhere in its
 public interface should have an `errors.rs` module containing error types
 which implement either `Display` or `Debug`. See the `errors.rs` addition
 to the `protover` crate from #24031 for an example.

 In the future, when failure is 1.0.0, we should also require
 `::failure::Fail` for making errors easier to work with between crates.

--

Comment (by chelseakomlo):

 Edited ticket description to note that documenting the requirement of
 `::failure::Fail` for failure types will be a separate task once the
 `failure` crate reaches stability. See #26337 for more information.

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


More information about the tor-bugs mailing list