git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [DISCUSS] Introducing Rust into the Git project
@ 2024-01-10 20:16 Taylor Blau
  2024-01-10 21:57 ` Dragan Simic
                   ` (4 more replies)
  0 siblings, 5 replies; 38+ messages in thread
From: Taylor Blau @ 2024-01-10 20:16 UTC (permalink / raw)
  To: git

Over the holiday break at the end of last year I spent some time
thinking on what it would take to introduce Rust into the Git project.

There is significant work underway to introduce Rust into the Linux
kernel (see [1], [2]). Among their stated goals, I think there are a few
which could be potentially relevant to the Git project:

  - Lower risk of memory safety bugs, data races, memory leaks, etc.
    thanks to the language's safety guarantees.

  - Easier to gain confidence when refactoring or introducing new code
    in Rust (assuming little to no use of the language's `unsafe`
    feature).

  - Contributing to Git becomes easier and accessible to a broader group
    of programmers by relying on a more modern language.

Given the allure of these benefits, I think it's at least worth
considering and discussing how Rust might make its way into Junio's
tree.

I imagine that the transition state would involve some parts of the
project being built in C and calling into Rust code via FFI (and perhaps
vice-versa, with Rust code calling back into the existing C codebase).
Luckily for us, Rust's FFI provides a zero-cost abstraction [3], meaning
there is no performance impact when calling code from one language in
the other.

Some open questions from me, at least to get the discussion going are:

  1. Platform support. The Rust compiler (rustc) does not enjoy the same
     widespread availability that C compilers do. For instance, I
     suspect that NonStop, AIX, Solaris, among others may not be
     supported.

     One possible alternative is to have those platforms use a Rust
     front-end for a compiler that they do support. The gccrs [4]
     project would allow us to compile Rust anywhere where GCC is
     available. The rustc_codegen_gcc [5] project uses GCC's libgccjit
     API to target GCC from rustc itself.

  2. Migration. What parts of Git are easiest to convert to Rust? My
     hunch is that the answer is any stand-alone libraries, like
     strbuf.h. I'm not sure how we should identify these, though, and in
     what order we would want to move them over.

  3. Interaction with the lib-ification effort. There is lots of work
     going on in an effort to lib-ify much of the Git codebase done by
     Google. I'm not sure how this would interact with that effort, but
     we should make sure that one isn't a blocker for the other.

I'm curious to hear what others think about this. I think that this
would be an exciting and worthwhile direction for the project. Let's
see!

Thanks,
Taylor

[1]: https://rust-for-linux.com/
[2]: https://lore.kernel.org/rust-for-linux/20210414184604.23473-1-ojeda@kernel.org/
[3]: https://blog.rust-lang.org/2015/04/24/Rust-Once-Run-Everywhere.html#c-talking-to-rust
[4]: https://github.com/Rust-GCC/gccrs
[5]: https://github.com/rust-lang/rustc_codegen_gcc

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2024-01-24  7:55 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 20:16 [DISCUSS] Introducing Rust into the Git project Taylor Blau
2024-01-10 21:57 ` Dragan Simic
2024-01-10 22:11   ` Junio C Hamano
2024-01-10 22:15     ` rsbecker
2024-01-10 22:26       ` Taylor Blau
2024-01-10 23:52         ` rsbecker
2024-01-11  0:59           ` Elijah Newren
2024-01-11  1:44             ` rsbecker
2024-01-11  2:21               ` Elijah Newren
2024-01-11  2:57                 ` rsbecker
2024-01-11  5:06                   ` Elijah Newren
2024-01-11  6:56                     ` Patrick Steinhardt
2024-01-11 13:07                     ` rsbecker
2024-01-11  2:55           ` brian m. carlson
2024-01-11  3:24             ` rsbecker
2024-01-11 20:07               ` Trevor Gross
2024-01-11 21:28                 ` rsbecker
2024-01-11 23:23                   ` Trevor Gross
2024-01-22 23:17           ` Defining a platform support policy (Was: [DISCUSS] Introducing Rust into the Git project) Emily Shaffer
2024-01-23  0:11             ` rsbecker
2024-01-23  0:57               ` Defining a platform support policy Junio C Hamano
2024-01-23  0:31             ` Junio C Hamano
2024-01-24  7:54             ` Defining a platform support policy (Was: [DISCUSS] Introducing Rust into the Git project) Elijah Newren
2024-01-10 23:40     ` [DISCUSS] Introducing Rust into the Git project brian m. carlson
2024-01-11  0:33   ` Elijah Newren
2024-01-11  5:39     ` Dragan Simic
2024-01-11 16:57       ` Elijah Newren
2024-01-17 21:30         ` Dragan Simic
2024-01-24  4:15           ` Elijah Newren
2024-01-24  5:14             ` Dragan Simic
2024-01-11  0:12 ` Elijah Newren
2024-01-11  5:33   ` Dragan Simic
2024-01-11  1:56 ` brian m. carlson
2024-01-11 11:45 ` Sam James
2024-01-11 23:48   ` brian m. carlson
2024-01-12  8:24     ` Sam James
2024-01-12 14:46       ` Antoni Boucher
2024-01-11 23:53 ` Trevor Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).