Skip to content
Snippets Groups Projects
  1. Oct 01, 2020
    • Martin von Zweigbergk's avatar
      rust: move rustfmt.toml to repo root so it can be used by `hg fix` · 426294d0
      Martin von Zweigbergk authored
      `hg fix` runs the formatters from the repo root so it doesn't pick up
      the `rustfmt.toml` configs we had in each the `hg-core`, `hg-cpython`,
      and `rhg` packages, which resulted in warnings about `async fn` not
      existing in Rust 2015. This patch moves the `rustfmt.toml` file to the
      root so `hg fix` will use it.
      
      By putting the `rustfmt.toml` file in a higher-level directory, it
      also applies to the `chg` and `hgcli` packages. That makes
      `test-check-rust-format.t` fail, so this patch also applies the new
      formatting rules to those packages.
      
      Differential Revision: https://phab.mercurial-scm.org/D9142
      426294d0
  2. Sep 27, 2018
    • Georges Racinet's avatar
      rust: pure Rust lazyancestors iterator · dbc28c91
      Georges Racinet authored
      This is the first of a patch series aiming to provide an
      alternative implementation in the Rust programming language
      of the _lazyancestorsiter from the ancestor module.
      
      This iterator has been brought to our attention by the people at
      Octobus, as a potential good candidate for incremental "oxydation"
      (rewriting in Rust), because it has shown performance issues lately
      and it merely deals with ints (revision numbers) obtained by calling
      the index, whih should be directly callable from Rust code,
      being itself implemented as a C extension.
      
      The idea behind this series is to provide a minimal example of Rust code
      collaborating with existing C and Python code. To open the way to gradually
      rewriting more of Mercurial's Python code in Rust, without being forced to pay
      a large initial cost of rewriting the existing fast core into Rust.
      
      This patch does not introduce any bindings to other Mercurial code
      yet. Instead, it introduces the necessary abstractions to address the problem
      independently, and unit-test it.
      
      Since this is the first use of Rust as a Python module within Mercurial,
      the hg-core crate gets created within this patch. See its Cargo.toml for more
      details.
      
      Someone with a rustc/cargo installation may chdir into rust/hg-core and
      run the tests by issuing:
      
         cargo test --lib
      
      The algorithm is a bit simplified (see details in docstrings),
      and at its simplest becomes rather trivial, showcasing that Rust has
      batteries included too: BinaryHeap, the Rust analog of Python's heapq
      does actually all the work.
      
      The implementation can be further optimized and probably be made more
      idiomatic Rust.
      dbc28c91
Loading