Contributing to Rust

  • 时间: 2020-05-27 08:22:07

~5 min reading time

I always enjoyed contributing my free time towards open-source, whether that be a small PR to fix a typo in the documentation or spending an entire year maintaining and developing for a semi-obscure game.

That was where I originally heard about Rust - it was used for one of the internal tools that had to rely on fast concurrency, something that seemed like an almost perfect fit for Rust. I still remember my first time wondering what this "cargo" thing was.

Fast forward a few months and some real life business, I suddenly recalled that I wanted to learn more about Rust, and thus my learning journey began. After I was somewhat comfortable with the basics of the language, mostly thanks to the helpful folks of Serenity Discord, I thought I should give back to the wider community at least a little bit.

Lying was never my strong side, and my first PR in the Rust repo was a very simple documentation clarification, since I really wanted that sweet "contributor" badge on GitHub. Even though that required very little effort on my part, it gave me an insight on how the contribution process works - when you submit a PR and are a new contributor, the Highfive bot posts a very helpful and welcoming message, and also assigns one of the Rust team members as a reviewer.

I expected to be waiting around a week or so for my change to even be looked at, to my surprise it took about an hour and it was already approved and being rolled up by bors, which is a very clever solution to bundle a bunch of merged PRs for extensive testing, since there are a ton of platforms that Rust tests on and the CI takes about 3 hours to complete.

After that, I was wondering how I could beactuallyhelpful, since anyone can copy-paste an issue into a PR for a small ego-boost. There is a ton of menial work to be done managing such a large project, and one of those things is triage - a way for simple folk like me to help. People working hard on speeding up compiler performance don't have the time to label all new GitHub issues or make sure no PR gets forgotten, that's where the triage workgroup comes in. Anyone can join, there are absolutely no requirements.

I sent a message to Dylan (@dpc), the person leading this group and also a member of the release team, who guided me through the process. I spent quite a while looking through all the repos in the rust-lang organisation, and I was pretty satisfied with the state of automation they have going on.

My first triaging session was on Wednesday, and I managed to mess up by pinging one of the team members (I was not a member of the org at this point, and some members hide their status), but Dylan was very understanding and told me how to add myself to the organisation properly.

The next thing to catch my eye was glacier - a catchy name that serves as a repository of ICEs, internal compiler errors. First I tried to run it on Windows and it reported that about half of the bugs have been fixed, I got in touch with @JohnTitor to ask about that, and he told me that a certain type of ICEs doesn't happen on Windows. A quick PR to add this note to the readme, and hopefully some time will be saved for other folks in the future.

After that I took a look at how people actually contribute towards glacier - having to manually submit PRs and browse through untracked issues is very much not ideal. I talked a bit with some members of the team about integrating it into one of the helpful bots, and someone told me there was an open issue suggesting that idea on the triagebot repository, which is a bot that is used to help label issues, ping relevant teams and a few other minor things.

Developing this PR was pretty difficult - I had no experience with interacting with the GitHub API and it seemed like there was a self-made wrapper around it, thankfully I came right at a time when XAMPPRocky was about to release octocrab, a very handy library to work with the GitHub API.

With this new addition it didn't take too long to develop and soon the PR was merged! Unfortunately, it currently doesn't work as well as planned, but at least the foundation is done. I still plan on improving it when I have a bit of time.

And as for you, dear reader, I wrote this blog post to inspire more people - especially beginners in both Rust and open-source as a whole to not be afraid of engaging with the Rust project. There are things for people of all skill levels to work on.