blob: 8598f0d371bbd4791216487331d95aa7a05d3fff [file] [log] [blame] [edit]
<!DOCTYPE HTML>
<html lang="en" class="sidebar-visible no-js light">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Getting Started - Guide to Rustc Development</title>
<!-- Custom HTML head -->
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="A guide to developing rustc">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff" />
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
</head>
<body>
<!-- Provide site root to javascript -->
<script type="text/javascript">
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script type="text/javascript">
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script type="text/javascript">
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('no-js')
html.classList.remove('light')
html.classList.add(theme);
html.classList.add('js');
</script>
<!-- Hide / unhide sidebar before it is displayed -->
<script type="text/javascript">
var html = document.querySelector('html');
var sidebar = 'hidden';
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
}
html.classList.remove('sidebar-visible');
html.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item affix "><a href="about-this-guide.html">About this guide</a></li><li class="chapter-item affix "><a href="getting-started.html" class="active">Getting Started</a></li><li class="spacer"></li><li class="chapter-item affix "><li class="part-title">Building and debugging rustc</li><li class="chapter-item "><a href="building/how-to-build-and-run.html"><strong aria-hidden="true">1.</strong> How to Build and Run the Compiler</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="building/prerequisites.html"><strong aria-hidden="true">1.1.</strong> Prerequisites</a></li><li class="chapter-item "><a href="building/suggested.html"><strong aria-hidden="true">1.2.</strong> Suggested Workflows</a></li><li class="chapter-item "><a href="building/build-install-distribution-artifacts.html"><strong aria-hidden="true">1.3.</strong> Distribution artifacts</a></li><li class="chapter-item "><a href="building/compiler-documenting.html"><strong aria-hidden="true">1.4.</strong> Documenting Compiler</a></li><li class="chapter-item "><a href="rustdoc.html"><strong aria-hidden="true">1.5.</strong> Rustdoc overview</a></li><li class="chapter-item "><a href="building/new-target.html"><strong aria-hidden="true">1.6.</strong> Adding a new target</a></li></ol></li><li class="chapter-item "><a href="tests/intro.html"><strong aria-hidden="true">2.</strong> The compiler testing framework</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="tests/running.html"><strong aria-hidden="true">2.1.</strong> Running tests</a></li><li class="chapter-item "><a href="tests/adding.html"><strong aria-hidden="true">2.2.</strong> Adding new tests</a></li><li class="chapter-item "><a href="compiletest.html"><strong aria-hidden="true">2.3.</strong> Using compiletest commands to control test execution</a></li></ol></li><li class="chapter-item "><a href="compiler-debugging.html"><strong aria-hidden="true">3.</strong> Debugging the Compiler</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="tracing.html"><strong aria-hidden="true">3.1.</strong> Using the tracing/logging instrumentation</a></li></ol></li><li class="chapter-item "><a href="profiling.html"><strong aria-hidden="true">4.</strong> Profiling the compiler</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="profiling/with_perf.html"><strong aria-hidden="true">4.1.</strong> with the linux perf tool</a></li><li class="chapter-item "><a href="profiling/wpa_profiling.html"><strong aria-hidden="true">4.2.</strong> with Windows Performance Analyzer</a></li></ol></li><li class="chapter-item "><a href="crates-io.html"><strong aria-hidden="true">5.</strong> crates.io Dependencies</a></li><li class="chapter-item affix "><li class="part-title">Contributing to Rust</li><li class="chapter-item "><a href="contributing.html"><strong aria-hidden="true">6.</strong> Introduction</a></li><li class="chapter-item "><a href="compiler-team.html"><strong aria-hidden="true">7.</strong> About the compiler team</a></li><li class="chapter-item "><a href="git.html"><strong aria-hidden="true">8.</strong> Using Git</a></li><li class="chapter-item "><a href="rustbot.html"><strong aria-hidden="true">9.</strong> Mastering @rustbot</a></li><li class="chapter-item "><a href="walkthrough.html"><strong aria-hidden="true">10.</strong> Walkthrough: a typical contribution</a></li><li class="chapter-item "><a href="bug-fix-procedure.html"><strong aria-hidden="true">11.</strong> Bug Fix Procedure</a></li><li class="chapter-item "><a href="implementing_new_features.html"><strong aria-hidden="true">12.</strong> Implementing new features</a></li><li class="chapter-item "><a href="stability.html"><strong aria-hidden="true">13.</strong> Stability attributes</a></li><li class="chapter-item "><a href="stabilization_guide.html"><strong aria-hidden="true">14.</strong> Stabilizing Features</a></li><li class="chapter-item "><a href="feature-gates.html"><strong aria-hidden="true">15.</strong> Feature Gates</a></li><li class="chapter-item "><a href="conventions.html"><strong aria-hidden="true">16.</strong> Coding conventions</a></li><li class="chapter-item "><a href="notification-groups/about.html"><strong aria-hidden="true">17.</strong> Notification groups</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="notification-groups/arm.html"><strong aria-hidden="true">17.1.</strong> ARM</a></li><li class="chapter-item "><a href="notification-groups/cleanup-crew.html"><strong aria-hidden="true">17.2.</strong> Cleanup Crew</a></li><li class="chapter-item "><a href="notification-groups/llvm.html"><strong aria-hidden="true">17.3.</strong> LLVM</a></li><li class="chapter-item "><a href="notification-groups/risc-v.html"><strong aria-hidden="true">17.4.</strong> RISC-V</a></li><li class="chapter-item "><a href="notification-groups/windows.html"><strong aria-hidden="true">17.5.</strong> Windows</a></li></ol></li><li class="chapter-item "><a href="licenses.html"><strong aria-hidden="true">18.</strong> Licenses</a></li><li class="chapter-item affix "><li class="part-title">High-level Compiler Architecture</li><li class="chapter-item "><a href="part-2-intro.html"><strong aria-hidden="true">19.</strong> Prologue</a></li><li class="chapter-item "><a href="overview.html"><strong aria-hidden="true">20.</strong> Overview of the Compiler</a></li><li class="chapter-item "><a href="compiler-src.html"><strong aria-hidden="true">21.</strong> The compiler source code</a></li><li class="chapter-item "><a href="building/bootstrapping.html"><strong aria-hidden="true">22.</strong> Bootstrapping</a></li><li class="chapter-item "><a href="query.html"><strong aria-hidden="true">23.</strong> Queries: demand-driven compilation</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="queries/query-evaluation-model-in-detail.html"><strong aria-hidden="true">23.1.</strong> The Query Evaluation Model in Detail</a></li><li class="chapter-item "><a href="queries/incremental-compilation.html"><strong aria-hidden="true">23.2.</strong> Incremental compilation</a></li><li class="chapter-item "><a href="queries/incremental-compilation-in-detail.html"><strong aria-hidden="true">23.3.</strong> Incremental compilation In Detail</a></li><li class="chapter-item "><a href="incrcomp-debugging.html"><strong aria-hidden="true">23.4.</strong> Debugging and Testing</a></li><li class="chapter-item "><a href="salsa.html"><strong aria-hidden="true">23.5.</strong> Salsa</a></li></ol></li><li class="chapter-item "><a href="memory.html"><strong aria-hidden="true">24.</strong> Memory Management in Rustc</a></li><li class="chapter-item "><a href="serialization.html"><strong aria-hidden="true">25.</strong> Serialization in Rustc</a></li><li class="chapter-item "><a href="parallel-rustc.html"><strong aria-hidden="true">26.</strong> Parallel Compilation</a></li><li class="chapter-item "><a href="rustdoc-internals.html"><strong aria-hidden="true">27.</strong> Rustdoc internals</a></li><li class="chapter-item affix "><li class="part-title">Source Code Representation</li><li class="chapter-item "><a href="part-3-intro.html"><strong aria-hidden="true">28.</strong> Prologue</a></li><li class="chapter-item "><a href="cli.html"><strong aria-hidden="true">29.</strong> Command-line arguments</a></li><li class="chapter-item "><a href="rustc-driver.html"><strong aria-hidden="true">30.</strong> The Rustc Driver and Interface</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="rustc-driver-interacting-with-the-ast.html"><strong aria-hidden="true">30.1.</strong> Ex: Type checking through rustc_interface</a></li><li class="chapter-item "><a href="rustc-driver-getting-diagnostics.html"><strong aria-hidden="true">30.2.</strong> Ex: Getting diagnostics through rustc_interface</a></li></ol></li><li class="chapter-item "><a href="syntax-intro.html"><strong aria-hidden="true">31.</strong> Syntax and the AST</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="the-parser.html"><strong aria-hidden="true">31.1.</strong> Lexing and Parsing</a></li><li class="chapter-item "><a href="macro-expansion.html"><strong aria-hidden="true">31.2.</strong> Macro expansion</a></li><li class="chapter-item "><a href="name-resolution.html"><strong aria-hidden="true">31.3.</strong> Name resolution</a></li><li class="chapter-item "><a href="test-implementation.html"><strong aria-hidden="true">31.4.</strong> #[test] Implementation</a></li><li class="chapter-item "><a href="panic-implementation.html"><strong aria-hidden="true">31.5.</strong> Panic Implementation</a></li><li class="chapter-item "><a href="ast-validation.html"><strong aria-hidden="true">31.6.</strong> AST Validation</a></li><li class="chapter-item "><a href="feature-gate-ck.html"><strong aria-hidden="true">31.7.</strong> Feature Gate Checking</a></li><li class="chapter-item "><a href="lang-items.html"><strong aria-hidden="true">31.8.</strong> Lang Items</a></li></ol></li><li class="chapter-item "><a href="hir.html"><strong aria-hidden="true">32.</strong> The HIR (High-level IR)</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="lowering.html"><strong aria-hidden="true">32.1.</strong> Lowering AST to HIR</a></li><li class="chapter-item "><a href="hir-debugging.html"><strong aria-hidden="true">32.2.</strong> Debugging</a></li></ol></li><li class="chapter-item "><a href="thir.html"><strong aria-hidden="true">33.</strong> The THIR (Typed High-level IR)</a></li><li class="chapter-item "><a href="mir/index.html"><strong aria-hidden="true">34.</strong> The MIR (Mid-level IR)</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="mir/construction.html"><strong aria-hidden="true">34.1.</strong> MIR construction</a></li><li class="chapter-item "><a href="mir/visitor.html"><strong aria-hidden="true">34.2.</strong> MIR visitor and traversal</a></li><li class="chapter-item "><a href="mir/passes.html"><strong aria-hidden="true">34.3.</strong> MIR passes: getting the MIR for a function</a></li></ol></li><li class="chapter-item "><a href="identifiers.html"><strong aria-hidden="true">35.</strong> Identifiers in the Compiler</a></li><li class="chapter-item "><a href="closure.html"><strong aria-hidden="true">36.</strong> Closure expansion</a></li><li class="chapter-item affix "><li class="part-title">Analysis</li><li class="chapter-item "><a href="part-4-intro.html"><strong aria-hidden="true">37.</strong> Prologue</a></li><li class="chapter-item "><a href="ty.html"><strong aria-hidden="true">38.</strong> The ty module: representing types</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="generics.html"><strong aria-hidden="true">38.1.</strong> Generics and substitutions</a></li><li class="chapter-item "><a href="ty-fold.html"><strong aria-hidden="true">38.2.</strong> TypeFolder and TypeFoldable</a></li><li class="chapter-item "><a href="generic_arguments.html"><strong aria-hidden="true">38.3.</strong> Generic arguments</a></li><li class="chapter-item "><a href="constants.html"><strong aria-hidden="true">38.4.</strong> Constants in the type system</a></li></ol></li><li class="chapter-item "><a href="type-inference.html"><strong aria-hidden="true">39.</strong> Type inference</a></li><li class="chapter-item "><a href="traits/resolution.html"><strong aria-hidden="true">40.</strong> Trait solving</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="early-late-bound.html"><strong aria-hidden="true">40.1.</strong> Early and Late Bound Parameters</a></li><li class="chapter-item "><a href="traits/hrtb.html"><strong aria-hidden="true">40.2.</strong> Higher-ranked trait bounds</a></li><li class="chapter-item "><a href="traits/caching.html"><strong aria-hidden="true">40.3.</strong> Caching subtleties</a></li><li class="chapter-item "><a href="traits/specialization.html"><strong aria-hidden="true">40.4.</strong> Specialization</a></li><li class="chapter-item "><a href="traits/chalk.html"><strong aria-hidden="true">40.5.</strong> Chalk-based trait solving</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="traits/lowering-to-logic.html"><strong aria-hidden="true">40.5.1.</strong> Lowering to logic</a></li><li class="chapter-item "><a href="traits/goals-and-clauses.html"><strong aria-hidden="true">40.5.2.</strong> Goals and clauses</a></li><li class="chapter-item "><a href="traits/canonical-queries.html"><strong aria-hidden="true">40.5.3.</strong> Canonical queries</a></li></ol></li></ol></li><li class="chapter-item "><a href="type-checking.html"><strong aria-hidden="true">41.</strong> Type checking</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="method-lookup.html"><strong aria-hidden="true">41.1.</strong> Method Lookup</a></li><li class="chapter-item "><a href="variance.html"><strong aria-hidden="true">41.2.</strong> Variance</a></li><li class="chapter-item "><a href="opaque-types-type-alias-impl-trait.html"><strong aria-hidden="true">41.3.</strong> Opaque Types</a></li></ol></li><li class="chapter-item "><a href="pat-exhaustive-checking.html"><strong aria-hidden="true">42.</strong> Pattern and Exhaustiveness Checking</a></li><li class="chapter-item "><a href="mir/dataflow.html"><strong aria-hidden="true">43.</strong> MIR dataflow</a></li><li class="chapter-item "><a href="borrow_check.html"><strong aria-hidden="true">44.</strong> The borrow checker</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="borrow_check/moves_and_initialization.html"><strong aria-hidden="true">44.1.</strong> Tracking moves and initialization</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="borrow_check/moves_and_initialization/move_paths.html"><strong aria-hidden="true">44.1.1.</strong> Move paths</a></li></ol></li><li class="chapter-item "><a href="borrow_check/type_check.html"><strong aria-hidden="true">44.2.</strong> MIR type checker</a></li><li class="chapter-item "><a href="borrow_check/region_inference.html"><strong aria-hidden="true">44.3.</strong> Region inference</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="borrow_check/region_inference/constraint_propagation.html"><strong aria-hidden="true">44.3.1.</strong> Constraint propagation</a></li><li class="chapter-item "><a href="borrow_check/region_inference/lifetime_parameters.html"><strong aria-hidden="true">44.3.2.</strong> Lifetime parameters</a></li><li class="chapter-item "><a href="borrow_check/region_inference/member_constraints.html"><strong aria-hidden="true">44.3.3.</strong> Member constraints</a></li><li class="chapter-item "><a href="borrow_check/region_inference/placeholders_and_universes.html"><strong aria-hidden="true">44.3.4.</strong> Placeholders and universes</a></li><li class="chapter-item "><a href="borrow_check/region_inference/closure_constraints.html"><strong aria-hidden="true">44.3.5.</strong> Closure constraints</a></li><li class="chapter-item "><a href="borrow_check/region_inference/error_reporting.html"><strong aria-hidden="true">44.3.6.</strong> Error reporting</a></li></ol></li><li class="chapter-item "><a href="borrow_check/two_phase_borrows.html"><strong aria-hidden="true">44.4.</strong> Two-phase-borrows</a></li></ol></li><li class="chapter-item "><a href="param_env.html"><strong aria-hidden="true">45.</strong> Parameter Environments</a></li><li class="chapter-item "><a href="diagnostics.html"><strong aria-hidden="true">46.</strong> Errors and Lints</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="diagnostics/sessiondiagnostic.html"><strong aria-hidden="true">46.1.</strong> Creating Errors With SessionDiagnostic</a></li><li class="chapter-item "><a href="diagnostics/lintstore.html"><strong aria-hidden="true">46.2.</strong> LintStore</a></li><li class="chapter-item "><a href="diagnostics/diagnostic-codes.html"><strong aria-hidden="true">46.3.</strong> Diagnostic Codes</a></li><li class="chapter-item "><a href="diagnostics/diagnostic-items.html"><strong aria-hidden="true">46.4.</strong> Diagnostic Items</a></li></ol></li><li class="chapter-item "><li class="part-title">MIR to Binaries</li><li class="chapter-item "><a href="part-5-intro.html"><strong aria-hidden="true">47.</strong> Prologue</a></li><li class="chapter-item "><a href="mir/optimizations.html"><strong aria-hidden="true">48.</strong> MIR optimizations</a></li><li class="chapter-item "><a href="mir/debugging.html"><strong aria-hidden="true">49.</strong> Debugging</a></li><li class="chapter-item "><a href="const-eval.html"><strong aria-hidden="true">50.</strong> Constant evaluation</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="miri.html"><strong aria-hidden="true">50.1.</strong> miri const evaluator</a></li></ol></li><li class="chapter-item "><a href="backend/monomorph.html"><strong aria-hidden="true">51.</strong> Monomorphization</a></li><li class="chapter-item "><a href="backend/lowering-mir.html"><strong aria-hidden="true">52.</strong> Lowering MIR</a></li><li class="chapter-item "><a href="backend/codegen.html"><strong aria-hidden="true">53.</strong> Code Generation</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="backend/updating-llvm.html"><strong aria-hidden="true">53.1.</strong> Updating LLVM</a></li><li class="chapter-item "><a href="backend/debugging.html"><strong aria-hidden="true">53.2.</strong> Debugging LLVM</a></li><li class="chapter-item "><a href="backend/backend-agnostic.html"><strong aria-hidden="true">53.3.</strong> Backend Agnostic Codegen</a></li><li class="chapter-item "><a href="backend/implicit-caller-location.html"><strong aria-hidden="true">53.4.</strong> Implicit Caller Location</a></li></ol></li><li class="chapter-item "><a href="backend/libs-and-metadata.html"><strong aria-hidden="true">54.</strong> Libraries and Metadata</a></li><li class="chapter-item "><a href="profile-guided-optimization.html"><strong aria-hidden="true">55.</strong> Profile-guided Optimization</a></li><li class="chapter-item "><a href="llvm-coverage-instrumentation.html"><strong aria-hidden="true">56.</strong> LLVM Source-Based Code Coverage</a></li><li class="chapter-item "><a href="sanitizers.html"><strong aria-hidden="true">57.</strong> Sanitizers Support</a></li><li class="chapter-item "><a href="debugging-support-in-rustc.html"><strong aria-hidden="true">58.</strong> Debugging Support in the Rust Compiler</a></li><li class="spacer"></li><li class="chapter-item affix "><a href="appendix/background.html">Appendix A: Background topics</a></li><li class="chapter-item affix "><a href="appendix/glossary.html">Appendix B: Glossary</a></li><li class="chapter-item affix "><a href="appendix/code-index.html">Appendix C: Code Index</a></li><li class="chapter-item affix "><a href="appendix/compiler-lecture.html">Appendix D: Compiler Lecture Series</a></li><li class="chapter-item affix "><a href="appendix/bibliography.html">Appendix E: Bibliography</a></li><li class="chapter-item affix "><a href="appendix/humorust.html">Appendix Z: HumorRust</a></li><li class="spacer"></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky bordered">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</button>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Guide to Rustc Development</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/rust-lang/rustc-dev-guide" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
<a href="https://github.com/rust-lang/rustc-dev-guide/tree/master/src/getting-started.md?mode&#x3D;edit" title="Suggest an edit" aria-label="Suggest an edit">
<i id="git-edit-button" class="fa fa-edit"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script type="text/javascript">
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="getting-started"><a class="header" href="#getting-started">Getting Started</a></h1>
<ul>
<li><a href="#asking-questions">Asking Questions</a>
<ul>
<li><a href="#experts">Experts</a></li>
<li><a href="#etiquette">Etiquette</a></li>
</ul>
</li>
<li><a href="#cloning-and-building">Cloning and Building</a>
<ul>
<li><a href="#system-requirements">System Requirements</a></li>
<li><a href="#cloning">Cloning</a></li>
<li><a href="#configuring-the-compiler">Configuring the Compiler</a></li>
<li><a href="#xpy-intro">x.py Intro</a></li>
<li><a href="#building-and-testing-rustc">Building and Testing <code>rustc</code></a></li>
<li><a href="#building-and-testing-stdcorealloctestproc_macroetc">Building and Testing <code>std</code>/<code>core</code>/<code>alloc</code>/<code>test</code>/<code>proc_macro</code>/etc.</a></li>
<li><a href="#building-and-testing-rustdoc">Building and Testing <code>rustdoc</code></a></li>
<li><a href="#contributing-code-to-other-rust-projects">Contributing code to other Rust projects</a></li>
<li><a href="#other-ways-to-contribute">Other ways to contribute</a></li>
</ul>
</li>
<li><a href="#contributor-procedures">Contributor Procedures</a>
<ul>
<li><a href="#code-review">Code Review</a></li>
<li><a href="#bug-fixes-or-normal-code-changes">Bug Fixes or &quot;Normal&quot; code changes</a></li>
<li><a href="#new-features">New Features</a></li>
<li><a href="#breaking-changes">Breaking Changes</a></li>
<li><a href="#major-changes">Major Changes</a></li>
<li><a href="#performance">Performance</a></li>
</ul>
</li>
<li><a href="#other-resources">Other Resources</a></li>
</ul>
<p>This documentation is <em>not</em> intended to be comprehensive; it is meant to be a
quick guide for the most useful things. For more information, <a href="./building/how-to-build-and-run.html">see this
chapter on how to build and run the compiler</a>.</p>
<h2 id="asking-questions"><a class="header" href="#asking-questions">Asking Questions</a></h2>
<p>The compiler team (or <code>t-compiler</code>) usually hangs out in Zulip <a href="https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler">in this
&quot;stream&quot;</a>; it will be easiest to get questions answered there.</p>
<p><strong>Please ask questions!</strong> A lot of people report feeling that they are &quot;wasting
expert time&quot;, but nobody on <code>t-compiler</code> feels this way. Contributors are
important to us.</p>
<p>Also, if you feel comfortable, prefer public topics, as this means others can
see the questions and answers, and perhaps even integrate them back into this
guide :)</p>
<h3 id="experts"><a class="header" href="#experts">Experts</a></h3>
<p>Not all <code>t-compiler</code> members are experts on all parts of <code>rustc</code>; it's a pretty
large project. To find out who has expertise on different parts of the
compiler, <a href="https://github.com/rust-lang/compiler-team/blob/master/content/experts/map.toml">consult this &quot;experts map&quot;</a>.</p>
<p>It's not perfectly complete, though, so please also feel free to ask questions
even if you can't figure out who to ping.</p>
<h3 id="etiquette"><a class="header" href="#etiquette">Etiquette</a></h3>
<p>We do ask that you be mindful to include as much useful information as you can
in your question, but we recognize this can be hard if you are unfamiliar with
contributing to Rust.</p>
<p>Just pinging someone without providing any context can be a bit annoying and
just create noise, so we ask that you be mindful of the fact that the
<code>t-compiler</code> folks get a lot of pings in a day.</p>
<h2 id="cloning-and-building"><a class="header" href="#cloning-and-building">Cloning and Building</a></h2>
<p>The main repository is <a href="https://github.com/rust-lang/rust"><code>rust-lang/rust</code></a>. This contains the compiler,
the standard library (including <code>core</code>, <code>alloc</code>, <code>test</code>, <code>proc_macro</code>, etc),
and a bunch of tools (e.g. <code>rustdoc</code>, the bootstrapping infrastructure, etc).</p>
<p>There are also a bunch of submodules for things like LLVM, <code>clippy</code>, <code>miri</code>,
etc. You don't need to clone these immediately, but the build tool will
automatically clone and sync them (more on this later).</p>
<p><a href="./building/suggested.html"><strong>Take a look at the &quot;Suggested Workflows&quot; chapter for some helpful
advice.</strong></a></p>
<h3 id="system-requirements"><a class="header" href="#system-requirements">System Requirements</a></h3>
<p><a href="./building/prerequisites.html"><strong>See this chapter for detailed software requirements.</strong></a>
Most notably, you will need Python 2 or 3 to run <code>x.py</code>.</p>
<p>There are no hard hardware requirements, but building the compiler is
computationally expensive, so a beefier machine will help, and I wouldn't
recommend trying to build on a Raspberry Pi :P</p>
<ul>
<li>Recommended &gt;=30GB of free disk space; otherwise, you will have to keep
clearing incremental caches. More space is better, the compiler is a bit of a
hog; it's a problem we are aware of.</li>
<li>Recommended &gt;=8GB RAM.</li>
<li>Recommended &gt;=2 cores; having more cores really helps.</li>
<li>You will need an internet connection to build; the bootstrapping process
involves updating git submodules and downloading a beta compiler. It doesn't
need to be super fast, but that can help.</li>
</ul>
<p>Building the compiler takes more than half an hour on my moderately powerful
laptop. The first time you build the compiler, LLVM will also be built unless
you use CI-built LLVM (<a href="#configuring-the-compiler">see below</a>).</p>
<p>Like <code>cargo</code>, the build system will use as many cores as possible. Sometimes
this can cause you to run low on memory. You can use <code>-j</code> to adjust the number
concurrent jobs. If a full build takes more than ~45 minutes to an hour,
you are probably spending most of the time swapping memory in and out;
try using <code>-j1</code>.</p>
<p>On a slow machine, the build times for rustc are very painful. Consider using
<code>./x.py check</code> instead of a full build and letting the automated tests run
when you push to GitHub.</p>
<p>If you don't have too much free disk space, you may want to turn off
incremental compilation (<a href="#configuring-the-compiler">see below</a>). This will make
compilation take longer (especially after a rebase),
but will save a ton of space from the incremental caches.</p>
<h3 id="cloning"><a class="header" href="#cloning">Cloning</a></h3>
<p>You can just do a normal git clone:</p>
<pre><code class="language-sh">git clone https://github.com/rust-lang/rust.git
</code></pre>
<p>You don't need to clone the submodules at this time. But if you want to, you
can do the following:</p>
<pre><code class="language-sh"># first time
git submodule update --init --recursive
# subsequent times (to pull new commits)
git submodule update
</code></pre>
<h3 id="configuring-the-compiler"><a class="header" href="#configuring-the-compiler">Configuring the Compiler</a></h3>
<p>The compiler has a configuration file which contains a ton of settings. We will
provide some recommendations here that should work for most, but <a href="./building/how-to-build-and-run.html#create-a-configtoml">check out
this chapter for more info</a>.</p>
<p>In the top level of the repo:</p>
<pre><code class="language-sh">$ x.py setup
</code></pre>
<p>This will walk you through an interactive setup for x.py that looks like this:</p>
<pre><code>$ x.py setup
Welcome to the Rust project! What do you want to do with x.py?
a) Contribute to the standard library
b) Contribute to the compiler
c) Contribute to the compiler, and also modify LLVM or codegen
d) Install Rust from source
Please choose one (a/b/c/d): a
`x.py` will now use the configuration at /home/joshua/rustc2/src/bootstrap/defaults/config.toml.library
To get started, try one of the following commands:
- `x.py check`
- `x.py build`
- `x.py test library/std`
- `x.py doc`
For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html
</code></pre>
<p>Note that by default, <code>x.py setup</code> will use CI-built LLVM if available for your
platform so that you don't need to build LLVM in addition to building the
compiler. In some circumstances, such as when updating the version of LLVM used
by <code>rustc</code>, you may want to temporarily disable this feature. See the <a href="https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html?highlight=download-ci-llvm#feature-updates">&quot;Updating
LLVM&quot; section</a> for more.</p>
<p>If you want to download LLVM from CI without running <code>x.py setup</code>, you can set
the <code>download-ci-llvm</code> option to <code>true</code> in your <code>config.toml</code>:</p>
<pre><code class="language-toml">[llvm]
download-ci-llvm = true
</code></pre>
<h3 id="xpy-intro"><a class="header" href="#xpy-intro">x.py Intro</a></h3>
<p><code>rustc</code> is a <em>bootstrapping</em> compiler, which means that it is written in Rust
and thus needs to be compiled by itself. So where do you
get the original compiler from? We use the current beta compiler
to build a new compiler. Then, we use that compiler to build itself. Thus,
<code>rustc</code> has a 2-stage build. You can read more about bootstrapping
<a href="./building/bootstrapping.html">here</a>, but you don't need to know much more to contribute.</p>
<p>We have a special tool <code>./x.py</code> that drives this process. It is used for
building the compiler, the standard libraries, and <code>rustdoc</code>. It is also used
for driving CI and building the final release artifacts.</p>
<p>Unfortunately, a proper 2-stage build takes a long time depending on your
hardware, but it is the only correct way to build everything (e.g. it's what
the CI and release processes use). <strong>However, in most cases, you can get by
without a full 2-stage build</strong>. In the following section, we give instructions
for how to do &quot;the correct thing&quot;, but then we also give various tips to speed
things up.</p>
<h3 id="building-and-testing-rustc"><a class="header" href="#building-and-testing-rustc">Building and Testing <code>rustc</code></a></h3>
<p>Here is a summary of the different commands for reference, but you probably
should still read the rest of the section:</p>
<table><thead><tr><th>Command</th><th>When to use it</th></tr></thead><tbody>
<tr><td><code>x.py check</code></td><td>Quick check to see if things compile; <a href="./building/suggested.html#configuring-rust-analyzer-for-rustc">rust-analyzer can run this automatically for you</a></td></tr>
<tr><td><code>x.py build --stage 0 [library/std]</code></td><td>Build only the standard library, without building the compiler</td></tr>
<tr><td><code>x.py build library/std</code></td><td>Build just the 1st stage of the compiler, along with the standard library; this is faster than building stage 2 and usually good enough</td></tr>
<tr><td><code>x.py build --keep-stage 1 library/std</code></td><td>Build the 1st stage of the compiler and skips rebuilding the standard library; this is useful after you've done an ordinary stage1 build to skip compilation time, but it can cause weird problems. (Just do a regular build to resolve.)</td></tr>
<tr><td><code>x.py test [--keep-stage 1]</code></td><td>Run the test suite using the stage1 compiler</td></tr>
<tr><td><code>x.py test --bless [--keep-stage 1]</code></td><td>Run the test suite using the stage1 compiler <em>and</em> update expected test output.</td></tr>
<tr><td><code>x.py build --stage 2 compiler/rustc</code></td><td>Do a full 2-stage build. You almost never want to do this.</td></tr>
<tr><td><code>x.py test --stage 2</code></td><td>Do a full 2-stage build and run all tests. You almost never want to do this.</td></tr>
</tbody></table>
<p>To do a full 2-stage build of the whole compiler, you should run this (after
updating <code>config.toml</code> as mentioned above):</p>
<pre><code class="language-sh">./x.py build --stage 2 compiler/rustc
</code></pre>
<p>In the process, this will also necessarily build the standard libraries, and it
will build <code>rustdoc</code> (which doesn't take too long).</p>
<p>To build and test everything:</p>
<pre><code class="language-sh">./x.py test
</code></pre>
<p>For most contributions, you only need to build stage 1, which saves a lot of time:</p>
<pre><code class="language-sh"># Build the compiler (stage 1)
./x.py build library/std
# Subsequent builds
./x.py build --keep-stage 1 library/std
</code></pre>
<p>This will take a while, especially the first time. Be wary of accidentally
touching or formatting the compiler, as <code>./x.py</code> will try to recompile it.</p>
<p><strong>NOTE</strong>: The <code>--keep-stage 1</code> will <em>assume</em> that the stage 0 standard library
does not need to be rebuilt, which is usually true, which will save some time.
However, if you are changing certain parts of the compiler, this may lead to
weird errors. Feel free to ask on <a href="https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler">zulip</a> if you are running into issues.</p>
<p>This runs a ton of tests and takes a long time to complete. If you are
working on <code>rustc</code>, you can usually get by with only the <a href="./tests/adding.html#ui">UI tests</a>. These
test are mostly for the frontend of the compiler, so if you are working on LLVM
or codegen, this shortcut will <em>not</em> test your changes. You can read more about the
different test suites <a href="https://rustc-dev-guide.rust-lang.org/tests/intro.html">in this chapter</a>.</p>
<pre><code class="language-sh"># First build
./x.py test src/test/ui
# Subsequent builds
./x.py test src/test/ui --keep-stage 1
</code></pre>
<p>If your changes impact test output, you can use <code>--bless</code> to automatically
update the <code>.stderr</code> files of the affected tests:</p>
<pre><code class="language-sh">./x.py test src/test/ui --keep-stage 1 --bless
</code></pre>
<p>While working on the compiler, it can be helpful to see if the code just
compiles (similar to <code>cargo check</code>) without actually building it. You can do
this with:</p>
<pre><code class="language-sh">./x.py check
</code></pre>
<p>This command is really fast (relative to the other commands). It usually
completes in a couple of minutes on my laptop. <strong>A common workflow when working
on the compiler is to make changes and repeatedly check with <code>./x.py check</code>.
Then, run the tests as shown above when you think things should work.</strong></p>
<p>Finally, the CI ensures that the codebase is using consistent style. To format
the code:</p>
<pre><code class="language-sh"># Actually format
./x.py fmt
# Just check formatting, exit with error
./x.py fmt --check
</code></pre>
<p><em>Note</em>: we don't use stable <code>rustfmt</code>; we use a pinned version with a special
config, so this may result in different style from normal <code>rustfmt</code> if you have
format-on-save turned on. It's a good habit to run <code>./x.py fmt</code> before every
commit, as this reduces conflicts later. The pinned version is built under
<code>build/&lt;target&gt;/stage0/bin/rustfmt</code>, so if you want, you can use it for a
single file or for format-on-save in your editor, which can be faster than <code>./x.py fmt</code>.
You'll have to pass the <!-- date: 2021-09 --> <code>--edition=2021</code> argument
yourself when calling <code>rustfmt</code> directly.</p>
<p>One last thing: you can use <code>RUSTC_LOG=XXX</code> to get debug logging. <a href="./tracing.html">Read more
here</a>. Notice the <code>C</code> in <code>RUSTC_LOG</code>. Other than that, it uses normal
<a href="https://crates.io/crates/env_logger"><code>env_logger</code></a> or <code>tracing</code> syntax.</p>
<h3 id="building-and-testing-stdcorealloctestproc_macroetc"><a class="header" href="#building-and-testing-stdcorealloctestproc_macroetc">Building and Testing <code>std</code>/<code>core</code>/<code>alloc</code>/<code>test</code>/<code>proc_macro</code>/etc.</a></h3>
<p>As before, technically the proper way to build one of these libraries is to use
the stage-2 compiler, which of course requires a 2-stage build, described above
(<code>./x.py build</code>).</p>
<p>In practice, though, you don't need to build the compiler unless you are
planning to use a recently added nightly feature. Instead, you can just build
stage 0, which uses the current beta compiler.</p>
<pre><code class="language-sh">./x.py build --stage 0
</code></pre>
<pre><code class="language-sh">./x.py test --stage 0 library/std
</code></pre>
<p>(The same works for <code>library/alloc</code>, <code>library/core</code>, etc.)</p>
<h3 id="building-and-testing-rustdoc"><a class="header" href="#building-and-testing-rustdoc">Building and Testing <code>rustdoc</code></a></h3>
<p><code>rustdoc</code> uses <code>rustc</code> internals (and, of course, the standard library), so you
will have to build the compiler and <code>std</code> once before you can build <code>rustdoc</code>.
As before, you can use <code>./x.py build</code> to do this. The first time you build,
the stage-1 compiler will also be built.</p>
<pre><code class="language-sh"># First build
./x.py build
# Subsequent builds
./x.py build --keep-stage 1
</code></pre>
<p>As with the compiler, you can do a fast check build:</p>
<pre><code class="language-sh">./x.py check
</code></pre>
<p>Rustdoc has two types of tests: content tests and UI tests.</p>
<pre><code class="language-sh"># Content tests
./x.py test src/test/rustdoc
# UI tests
./x.py test src/test/rustdoc-ui
# Both at once
./x.py test src/test/rustdoc src/test/rustdoc-ui
</code></pre>
<h3 id="contributing-code-to-other-rust-projects"><a class="header" href="#contributing-code-to-other-rust-projects">Contributing code to other Rust projects</a></h3>
<p>There are a bunch of other projects that you can contribute to outside of the
<code>rust-lang/rust</code> repo, including <code>clippy</code>, <code>miri</code>, <code>chalk</code>, and many others.</p>
<p>These repos might have their own contributing guidelines and procedures. Many
of them are owned by working groups (e.g. <code>chalk</code> is largely owned by
WG-traits). For more info, see the documentation in those repos' READMEs.</p>
<h3 id="other-ways-to-contribute"><a class="header" href="#other-ways-to-contribute">Other ways to contribute</a></h3>
<p>There are a bunch of other ways you can contribute, especially if you don't
feel comfortable jumping straight into the large <code>rust-lang/rust</code> codebase.</p>
<p>The following tasks are doable without much background knowledge but are
incredibly helpful:</p>
<ul>
<li><a href="./notification-groups/cleanup-crew.html">Cleanup crew</a>: find minimal reproductions of ICEs, bisect
regressions, etc. This is a way of helping that saves a ton of time for
others to fix an error later.</li>
<li><a href="./contributing.html#writing-documentation">Writing documentation</a>: if you are feeling a bit more intrepid, you could try
to read a part of the code and write doc comments for it. This will help you
to learn some part of the compiler while also producing a useful artifact!</li>
<li><a href="https://rust-lang.github.io/compiler-team/working-groups/">Working groups</a>: there are a bunch of working groups on a wide variety
of rust-related things.</li>
</ul>
<h2 id="contributor-procedures"><a class="header" href="#contributor-procedures">Contributor Procedures</a></h2>
<p>There are some official procedures to know about. This is a tour of the
highlights, but there are a lot more details, which we will link to below.</p>
<h3 id="code-review"><a class="header" href="#code-review">Code Review</a></h3>
<p>When you open a PR on the <code>rust-lang/rust</code> repo, a bot called <code>@rust-highfive</code> will
automatically assign a reviewer to the PR. The reviewer is the person that will
approve the PR to be tested and merged. If you want a specific reviewer (e.g. a
team member you've been working with), you can specifically request them by
writing <code>r? @user</code> (e.g. <code>r? @eddyb</code>) in either the original post or a followup
comment (you can see <a href="https://github.com/rust-lang/rust/pull/78133#issuecomment-712692371">this comment</a> for example).</p>
<p>Please note that the reviewers are humans, who for the most part work on <code>rustc</code>
in their free time. This means that they can take some time to respond and review
your PR. It also means that reviewers can miss some PRs that are assigned to them.</p>
<p>To try to move PRs forward, the Triage WG regularly goes through all PRs that
are waiting for review and haven't been discussed for at least 2 weeks. If you
don't get a review within 2 weeks, feel free to ask the Triage WG on
Zulip (<a href="https://rust-lang.zulipchat.com/#narrow/stream/242269-t-release.2Ftriage">#t-release/triage</a>). They have knowledge of when to ping, who might be
on vacation, etc.</p>
<p>The reviewer may request some changes using the GitHub code review interface.
They may also request special procedures (such as a <a href="https://github.com/rust-lang/crater">crater</a> run; <a href="#breaking-changes">see
below</a>) for some PRs.</p>
<p>When the PR is ready to be merged, the reviewer will issue a command to
<code>@bors</code>, the CI bot. Usually, this is <code>@bors r+</code> or <code>@bors r=user</code> to approve
a PR (there are few other commands, but they are less relevant here).
You can see <a href="https://github.com/rust-lang/rust/pull/78133#issuecomment-712726339">this comment</a> for example. This puts the PR in <a href="https://bors.rust-lang.org/queue/rust">bors's queue</a>
to be tested and merged. Be patient; this can take a while and the queue can
sometimes be long. PRs are never merged by hand.</p>
<h3 id="bug-fixes-or-normal-code-changes"><a class="header" href="#bug-fixes-or-normal-code-changes">Bug Fixes or &quot;Normal&quot; code changes</a></h3>
<p>For most PRs, no special procedures are needed. You can just open a PR, and it
will be reviewed, approved, and merged. This includes most bug fixes,
refactorings, and other user-invisible changes. The next few sections talk
about exceptions to this rule.</p>
<p>Also, note that it is perfectly acceptable to open WIP PRs or GitHub <a href="https://github.blog/2019-02-14-introducing-draft-pull-requests/">Draft
PRs</a>. Some people prefer to do this so they can get feedback along the
way or share their code with a collaborator. Others do this so they can utilize
the CI to build and test their PR (e.g. if you are developing on a laptop).</p>
<h3 id="new-features"><a class="header" href="#new-features">New Features</a></h3>
<p>Rust has strong backwards-compatibility guarantees. Thus, new features can't
just be implemented directly in stable Rust. Instead, we have 3 release
channels: stable, beta, and nightly.</p>
<ul>
<li><strong>Stable</strong>: this is the latest stable release for general usage.</li>
<li><strong>Beta</strong>: this is the next release (will be stable within 6 weeks).</li>
<li><strong>Nightly</strong>: follows the <code>master</code> branch of the repo. This is the only
channel where unstable, incomplete, or experimental features are usable with
feature gates.</li>
</ul>
<p>In order to implement a new feature, usually you will need to go through <a href="https://github.com/rust-lang/rfcs/blob/master/README.md">the
RFC process</a> to propose a design, have discussions, etc. In some cases,
small features can be added with only an FCP (<a href="#breaking-changes">see below</a>). If in doubt, ask the
compiler, language, or libs team (whichever is most relevant).</p>
<p>After a feature is approved to be added, a tracking issue is created on the
<code>rust-lang/rust</code> repo, which tracks the progress towards the implementation of
the feature, any bugs reported, and eventually stabilization.</p>
<p>The feature then needs to be implemented behind a feature gate, which prevents
it from being accidentally used.</p>
<p>Finally, somebody may propose stabilizing the feature in an upcoming version of
Rust. This requires a Final Comment Period (<a href="#breaking-changes">see below</a>) to get the
approval of the relevant teams.</p>
<p>After that, the feature gate can be removed and the feature turned on for all users.</p>
<p>For more details on this process, see <a href="./implementing_new_features.html">this chapter on implementing new
features.</a></p>
<h3 id="breaking-changes"><a class="header" href="#breaking-changes">Breaking Changes</a></h3>
<p>As mentioned above, Rust has strong backwards-compatibility guarantees. To this
end, we are reluctant to make breaking changes. However, sometimes they are
needed to correct compiler bugs (e.g. code that compiled but should not) or
make progress on some features.</p>
<p>Depending on the scale of the breakage, there are a few different actions that
can be taken. If the reviewer believes the breakage is very minimal (i.e. very
unlikely to be actually encountered by users), they may just merge the change.
More often, they will request a Final Comment Period (FCP), which calls for
rough consensus among the members of a relevant team. The team members can
discuss the issue and either accept, reject, or request changes on the PR.</p>
<p>If the scale of breakage is large, a deprecation warning may be needed. This is
a warning that the compiler will display to users whose code will break in the
future. After some time, an FCP can be used to move forward with the actual
breakage.</p>
<p>If the scale of breakage is unknown, a team member or contributor may request a
<a href="https://github.com/rust-lang/crater">crater</a> run. This is a bot that will compile all crates.io crates and many
public github repos with the compiler with your changes. A report will then be
generated with crates that ceased to compile with or began to compile with your
changes. Crater runs can take a few days to complete.</p>
<h3 id="major-changes"><a class="header" href="#major-changes">Major Changes</a></h3>
<p>The compiler team has a special process for large changes, whether or not they
cause breakage. This process is called a Major Change Proposal (MCP). MCP is a
relatively lightweight mechanism for getting feedback on large changes to the
compiler (as opposed to a full RFC or a design meeting with the team).</p>
<p>Example of things that might require MCPs include major refactorings, changes
to important types, or important changes to how the compiler does something, or
smaller user-facing changes.</p>
<p><strong>When in doubt, ask on <a href="https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler">zulip</a>. It would be a shame to put a lot of work
into a PR that ends up not getting merged!</strong> <a href="https://forge.rust-lang.org/compiler/mcp.html">See this document</a> for
more info on MCPs.</p>
<h3 id="performance"><a class="header" href="#performance">Performance</a></h3>
<p>Compiler performance is important. We have put a lot of effort over the last
few years into <a href="https://perf.rust-lang.org/dashboard.html">gradually improving it</a>.</p>
<p>If you suspect that your change may cause a performance regression (or
improvement), you can request a &quot;perf run&quot; (your reviewer may also request one
before approving). This is yet another bot that will compile a collection of
benchmarks on a compiler with your changes. The numbers are reported
<a href="https://perf.rust-lang.org">here</a>, and you can see a comparison of your changes against the latest
master.</p>
<h2 id="other-resources"><a class="header" href="#other-resources">Other Resources</a></h2>
<ul>
<li>This guide: talks about how <code>rustc</code> works</li>
<li><a href="https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler">The t-compiler zulip</a></li>
<li><a href="https://doc.rust-lang.org/nightly/nightly-rustc/">The compiler's documentation (rustdocs)</a></li>
<li><a href="https://forge.rust-lang.org/">The Forge</a> has more documentation about various procedures.</li>
<li><code>#contribute</code> and <code>#rustdoc</code> on <a href="https://discord.gg/rust-lang">Discord</a>.</li>
</ul>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="about-this-guide.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next" href="building/how-to-build-and-run.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="about-this-guide.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next" href="building/how-to-build-and-run.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script type="text/javascript">
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
<script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
<script src="searcher.js" type="text/javascript" charset="utf-8"></script>
<script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script>
<script src="highlight.js" type="text/javascript" charset="utf-8"></script>
<script src="book.js" type="text/javascript" charset="utf-8"></script>
<!-- Custom JS scripts -->
</body>
</html>