|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: Contributing to Rust — language, compiler, and the standard library · The Rust Programming Language |
| 4 | +--- |
| 5 | + |
| 6 | +# Contributing to Rust — language, compiler, and the standard library |
| 7 | + |
| 8 | + |
| 9 | +The source code to the compiler and standard library are in the main |
| 10 | +repository, and as their maintenance is the primary objective of that |
| 11 | +repository, many labels on the issue tracker relate to it. Some of |
| 12 | +the more fruitful labels include [A-codegen], for translation of |
| 13 | +Rust to LLVM IR; [A-debuginfo], generation of metadata used by debuggers; |
| 14 | +[A-diagnostics], the feedback the compiler provides on errors; [A-libs], |
| 15 | +issues with the standard library; [A-macros] and [A-syntaxext], both |
| 16 | +related to syntax extensions; and [A-typesystem], on the topic of types. |
| 17 | + |
| 18 | +There is no well-maintained guide to the architecture of the compiler, |
| 19 | +but [there is a small overview in-tree][rustc-guide]. The [API |
| 20 | +documentation for the crates that make up the |
| 21 | +compiler][internals-docs] can help with navigating the code, as can |
| 22 | +the source code browser [Rust DXR]. The [guide to the Rust test |
| 23 | +suite][testsuite] will teach you how to exercise the Rust build system |
| 24 | +effectively, as will running [`make tips`][tips] at the command line. |
| 25 | + |
| 26 | +For the foreseable future, one of the major thrusts of Rust compiler |
| 27 | +development is converting its internals from operating directly off |
| 28 | +the AST to working with an [intermediate representation called |
| 29 | +MIR][mir]. This work is expected to open up many new possibilities by |
| 30 | +simplifying the compiler and help is needed to e.g. create a MIR-based |
| 31 | +translation pass, add MIR-based optimizations, and implement |
| 32 | +incremental compilation. There is yet no single source for information |
| 33 | +on work needed here, but ask on [internals.rust-lang.org] or |
| 34 | +[#rust-internals] for guidance. |
| 35 | + |
| 36 | +[It's embarrasing when our compiler crashes][ice] — the |
| 37 | +dreaded 'internal compiler error' (ICE). The [I-ICE] label |
| 38 | +tracks these, and they are often plentiful. These are usually |
| 39 | +good bugs to start with because it's easy to know when you've fixed |
| 40 | +them, and they're often relatively self-contained. |
| 41 | + |
| 42 | +The performance of Rust code is one of its great advantages; and the |
| 43 | +performance of the Rust compiler one of its great weaknesses. Any |
| 44 | +improvements to either runtime or — especially — compiletime performance |
| 45 | +are widely celebrated. The [I-slow] and [A-optimization] labels deal |
| 46 | +with runtime performance, and [I-compiletime] with compiletime. We have |
| 47 | +a [site that tracks compiletime performance][rustc-perf] on a number |
| 48 | +of workloads. The `-Z time-passes` compiler flag can help debug |
| 49 | +compiler performance, and Rust code can be profiled with standard |
| 50 | +profilers like `perf` on Linux. |
| 51 | + |
| 52 | +Major new features go through a [Request for Comments (RFC)][rfc] |
| 53 | +process, by which the design is agreed upon. Though it is open to all, |
| 54 | +it is a social process between developers who already have various |
| 55 | +amounts of experience working together, and it is recommended to get |
| 56 | +involved slowly — submitting a hasty RFC without understanding |
| 57 | +the historical, technical, or social context is an easy way |
| 58 | +to make a poor impression and come away disappointed. Read the |
| 59 | +aforelinkd readme file to understand best how it all works. Many |
| 60 | +ideas have been debated in Rust's history, some rejected, some |
| 61 | +postponed until the future, and the RFC [issue tracker][rfc-issues] |
| 62 | +catalogs some wishlist ideas that have yet to make headway into the |
| 63 | +language. Shortly before an RFC is accepted for implementation it |
| 64 | +enters 'final commemnt period', indicated by the [final-comment-period |
| 65 | +label on the rust-lang/rfcs repository][rfc-fcp]. Likewise, before a |
| 66 | +feature is enabled in the stable compiler (called 'ungating') it |
| 67 | +enters [final-comment-period in the rust-lang/rust |
| 68 | +repository][issue-fcp]. Both FCPs are critical moments to get involved |
| 69 | +and express opinions on the direction of the language, and are |
| 70 | +advertised in the weekly subteam reports on [internals.rust-lang.org]. |
| 71 | + |
| 72 | +Meet other Rust compiler engineers in [#rustc], language |
| 73 | +designers in [#rust-lang], and library designers in [#rust-libs]. |
| 74 | + |
| 75 | +<!-- |
| 76 | +TODO: guide to compile-time benchmarking |
| 77 | +TODO: using the triage bot? |
| 78 | +TODO: some of this RFC description could probably go in the RFC readme |
| 79 | +--> |
| 80 | + |
| 81 | + |
| 82 | +[#rust-internals]: https://client00.chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals |
| 83 | +[#rust-lang]: https://client00.chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-lang |
| 84 | +[#rust-libs]: https://client00.chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-libs |
| 85 | +[#rustc]: https://client00.chat.mibbit.com/?server=irc.mozilla.org&channel=%23rustc |
| 86 | +[A-codegen]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-codegen |
| 87 | +[A-debuginfo]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-debuginfo |
| 88 | +[A-diagnostics]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-diagnostics |
| 89 | +[A-libs]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-libs |
| 90 | +[A-macros]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-macros |
| 91 | +[A-optimization]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-optimization |
| 92 | +[A-syntaxext]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-syntaxext |
| 93 | +[A-typesystem]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-typesystem |
| 94 | +[I-ICE]: https://github.com/rust-lang/rust/labels/I-ICE |
| 95 | +[I-compiletime]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AI-compiletime |
| 96 | +[I-slow]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AI-slow |
| 97 | +[Rust DXR]: https://dxr.mozilla.org/rust/source/src |
| 98 | +[ice]: https://users.rust-lang.org/t/glacier-a-big-ol-pile-of-ice/3380 |
| 99 | +[internals-docs]: http://manishearth.github.com/rust-internals-docs |
| 100 | +[internals.rust-lang.org]: https://internals.rust-lang.org/ |
| 101 | +[issue-fcp]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AB-unstable+label%3Afinal-comment-period |
| 102 | +[mir]: https://github.com/rust-lang/rust/issues/27840 |
| 103 | +[rfc-fcp]: https://github.com/rust-lang/rfcs/pulls?q=is%3Aopen+is%3Apr+label%3Afinal-comment-period |
| 104 | +[rfc-issues]: https://github.com/rust-lang/rfcs/issues |
| 105 | +[rfc]: https://github.com/rust-lang/rfcs#table-of-contents |
| 106 | +[rustc-guide]: https://github.com/rust-lang/rust/blob/master/src/librustc/README.md |
| 107 | +[rustc-perf]: http://ncameron.org/perf-rustc/ |
| 108 | +[testsuite]: https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md |
| 109 | +[tips]: https://github.com/rust-lang/rust/blob/3d1f3c9d389d46607ae28c51cc94c1f43d65f3f9/Makefile.in#L48 |
0 commit comments