Requesting the Rust compiler community's assistance with a compiler for build logic

cross-posted to rust's reddit

Hello Rust compiler folks! We are very happy to have 30k lines of Rust (about 30% of the codebase) making up the core of the Pants build tool's upcoming 2.0 release! Rust has been a great platform for us: thank you to the entire community for making it such a powerful and productive environment to work in. Before launching 2.0 though, we have a few more things to nail down, and one of them we could use the Rust (compiler) community's help with.

Pant's plugin API is built around @rules, which are typed functions or coroutines (in Python) that the Pants engine composes based on their type signatures. That composition is known as "rule graph construction", and it's akin to "compiling" the set of @rules to decide which of them to use at each use site, and what scoped variables to provide to them.

Rule graph construction is implemented in Rust (using the petgraph crate, which has been wonderful!), and while the current implementation was recently modernized and is sufficient for most of our usecases, we're still hitting some limits with larger @rule graphs. We suspect that these issues are due almost entirely to a lack of experience in writing and maintaining compilers.

On behalf of the Pants community, I'd like to humbly ask the Rust (compiler) community for the huge favor of your insight on this problem: if you have time to read and post either here or on the associated github issue, it would be very appreciated!


The problem statement (in particular the Issue Overview near the end):

https://www.pantsbuild.org/v2.0/docs/internal-rules-architecture

Thank you!

Amazing! Sorry for the shameless plug but petgraph crate has only a few active maintainers lately, and I am overwhelmed with many other FOSS projects. So any help with reviewing pull requests, testing, and fixing bugs would be greatly appreciated. Also see https://github.com/petgraph/petgraph/issues/342 if you have any suggestions.

Thank you: petgraph has been great for this project, so we certainly owe the project some time back. Hopefully once we get this resolved we can pay our dues =)

1 Like

FYI, in your documentation, all the links in the table of contents loop back to the current page until a particular script is loaded from an external site. This may be making your site impenetrable to search engines and screenreaders, as well as to security freaks like me who disable third-party JavaScript. :wink:

5 Likes