Before You Start
Read the rustc-dev-guide
Familiarize yourself with the rustc-dev-guide to understand the compiler architecture and development practices
Find an Issue
Look for issues labeled with
E-easy, E-mentor, or good first issue on the issue trackerMaking Changes
1. Create a Branch
Create a new branch for your work:Use descriptive branch names that reference the issue number or describe the change, e.g.,
fix-ice-in-trait-resolution or improve-error-message-12345.2. Make Your Changes
Edit the relevant source files. The main areas of the codebase include:| Directory | Purpose |
|---|---|
compiler/ | Compiler implementation (rustc) |
library/ | Standard library and core libraries |
src/tools/ | Additional tools (Cargo, rustfmt, Clippy, etc.) |
tests/ | Test suites |
3. Build and Test Locally
Before committing, verify your changes:- Quick Check
- Full Build
- Run Tests
Use This is much faster than a full build and catches most compilation errors.
check for fast feedback without generating binaries:4. Tidy Check
The Rust project uses a tidy script to enforce style and consistency:- Code formatting issues
- Missing license headers
- Trailing whitespace
- File naming conventions
- Other project-specific rules
Writing Good Commit Messages
Commit messages should be clear and descriptive:Commit Message Guidelines
- First line: Brief summary (50 characters or less)
- Body: Detailed explanation of what and why (wrap at 72 characters)
- References: Include
Fixes #issue-numberto auto-close issues
Creating a Pull Request
1. Push Your Branch
2. Open the Pull Request
Go to github.com/rust-lang/rust and click “New Pull Request”.3. Write a Good PR Description
Your PR description should include:
Example PR template:
The Review Process
Understanding the Bots
Rust uses several bots to manage the development workflow:bors - The Merge Bot
bors - The Merge Bot
bors manages the merge queue and runs CI tests before merging.Common commands:
@bors r+- Approve and queue for merging (reviewers only)@bors r+ rollup- Approve for rollup (low-risk changes)@bors try- Run CI without merging (reviewers only)
rustbot - The Issue Bot
rustbot - The Issue Bot
rustbot helps with issue and PR management.Common commands:
@rustbot label +T-compiler- Add labels@rustbot ready- Mark PR as ready for review@rustbot author- Move PR back to author for changes
triagebot - The Triage Bot
triagebot - The Triage Bot
triagebot automates PR assignment and notifications.Handles:
- Automatic reviewer assignment
- Ping groups (e.g.,
@rustbot ping windows) - PR state transitions
Typical Review Timeline
Initial Review (1-7 days)
A reviewer will be assigned automatically or you can request one with
r? @usernameIf CI fails, bors will post the failure details. You’ll need to fix the issues and the reviewer will re-approve with
@bors r+.Responding to Review Feedback
Making Changes
When a reviewer requests changes:Rebasing on Latest Master
If your PR has conflicts or you want the latest changes:CI and Automated Testing
The Rust CI system runs comprehensive tests on every PR:CI Jobs
The CI runs multiple jobs defined in.github/workflows/ci.yml:
- x86_64-gnu-llvm: Linux build with LLVM tests
- x86_64-gnu-tools: Tests for rustfmt, Clippy, etc.
- mingw-check: Windows MinGW build
- x86_64-msvc: Windows MSVC build
- dist-various-1: Distribution builds for various targets
- And many more…
Try Builds
Reviewers can trigger a “try build” before approving:- Testing platform-specific changes
- Verifying fixes before approval
- Running performance tests
Special Cases
Rollup PRs
Low-risk changes (like docs, test additions) are often combined into “rollup” PRs:Performance Impact
For changes that might affect performance:Backports
Critical fixes may need backporting to beta or stable:- Add the
beta-nominatedorstable-nominatedlabel - Justify the backport in a comment
- The release team will review and approve
Best Practices
Keep PRs Focused
One logical change per PR. Avoid mixing refactoring with new features.
Write Tests
Always add tests for bug fixes and new features.
Update Docs
If you change public APIs, update the documentation.
Be Patient
Reviewers are volunteers. Reviews can take days or weeks.
Ask Questions
If you’re unsure, ask on Zulip. The community is helpful!
Run Tidy
Always run
./x.py test tidy before pushing.Common Workflow Commands
Here’s a quick reference of common commands:Getting Help
If you get stuck at any point:Zulip Chat
Real-time help from the community
rustc-dev-guide
Comprehensive development documentation
This Week in Rust
Stay updated with Rust development
Forge
Team documentation and procedures
Next Steps
Testing Guidelines
Learn how to write effective tests for your contributions