Rollup merge of #141269 - tshepang:rdg-push, r=jieyouxu

rustc-dev-guide subtree update

r? `@ghost`
This commit is contained in:
Matthias Krüger 2025-05-20 16:50:41 +02:00 committed by GitHub
commit e3d1a4e545
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 20 additions and 27 deletions

View File

@ -1 +1 @@
414482f6a0d4e7290f614300581a0b55442552a3 e42bbfe1f7c26f8760a99c4b1f27d33aba1040bb

View File

@ -134,9 +134,9 @@
- [Command-line arguments](./cli.md) - [Command-line arguments](./cli.md)
- [rustc_driver and rustc_interface](./rustc-driver/intro.md) - [rustc_driver and rustc_interface](./rustc-driver/intro.md)
- [Remarks on perma-unstable features](./rustc-driver/remarks-on-perma-unstable-features.md)
- [Example: Type checking](./rustc-driver/interacting-with-the-ast.md) - [Example: Type checking](./rustc-driver/interacting-with-the-ast.md)
- [Example: Getting diagnostics](./rustc-driver/getting-diagnostics.md) - [Example: Getting diagnostics](./rustc-driver/getting-diagnostics.md)
- [Remarks on perma-unstable features](./rustc-driver/remarks-on-perma-unstable-features.md)
- [Errors and lints](diagnostics.md) - [Errors and lints](diagnostics.md)
- [Diagnostic and subdiagnostic structs](./diagnostics/diagnostic-structs.md) - [Diagnostic and subdiagnostic structs](./diagnostics/diagnostic-structs.md)
- [Translation](./diagnostics/translation.md) - [Translation](./diagnostics/translation.md)

View File

@ -28,8 +28,8 @@ format is specific to `rustc`, and may change over time. This file contains:
[`-C embed-bitcode=no`][embed-bitcode] CLI option to improve compile times [`-C embed-bitcode=no`][embed-bitcode] CLI option to improve compile times
and reduce disk space if LTO is not needed. and reduce disk space if LTO is not needed.
* `rustc` [metadata], in a file named `lib.rmeta`. * `rustc` [metadata], in a file named `lib.rmeta`.
* A symbol table, which is generally a list of symbols with offsets to the * A symbol table, which is essentially a list of symbols with offsets to the
object file that contain that symbol. This is pretty standard for archive object files that contain that symbol. This is pretty standard for archive
files. files.
[archive file]: https://en.wikipedia.org/wiki/Ar_(Unix) [archive file]: https://en.wikipedia.org/wiki/Ar_(Unix)
@ -46,12 +46,11 @@ A `dylib` is a platform-specific shared library. It includes the `rustc`
### rmeta ### rmeta
An `rmeta` file is custom binary format that contains the [metadata] for the An `rmeta` file is a custom binary format that contains the [metadata] for the
crate. This file can be used for fast "checks" of a project by skipping all crate. This file can be used for fast "checks" of a project by skipping all code
code generation (as is done with `cargo check`), collecting enough information generation (as is done with `cargo check`), collecting enough information for
for documentation (as is done with `cargo doc`), or for documentation (as is done with `cargo doc`), or for [pipelining](#pipelining).
[pipelining](#pipelining). This file is created if the This file is created if the [`--emit=metadata`][emit] CLI option is used.
[`--emit=metadata`][emit] CLI option is used.
`rmeta` files do not support linking, since they do not contain compiled `rmeta` files do not support linking, since they do not contain compiled
object files. object files.
@ -60,8 +59,8 @@ object files.
## Metadata ## Metadata
The metadata contains a wide swath of different elements. This guide will not The metadata contains a wide swath of different elements. This guide will not go
go into detail of every field it contains. You are encouraged to browse the into detail about every field it contains. You are encouraged to browse the
[`CrateRoot`] definition to get a sense of the different elements it contains. [`CrateRoot`] definition to get a sense of the different elements it contains.
Everything about metadata encoding and decoding is in the [`rustc_metadata`] Everything about metadata encoding and decoding is in the [`rustc_metadata`]
package. package.
@ -122,9 +121,9 @@ much more.
By default, all Rust symbols are mangled and incorporate the stable crate id. By default, all Rust symbols are mangled and incorporate the stable crate id.
This allows multiple versions of the same crate to be included together. Cargo This allows multiple versions of the same crate to be included together. Cargo
automatically generates `-C metadata` hashes based on a variety of factors, automatically generates `-C metadata` hashes based on a variety of factors, like
like the package version, source, and the target kind (a lib and test can have the package version, source, and target kind (a lib and test can have the same
the same crate name, so they need to be disambiguated). crate name, so they need to be disambiguated).
[`StableCrateId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/def_id/struct.StableCrateId.html [`StableCrateId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/def_id/struct.StableCrateId.html
[`StableCrateId::new`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/def_id/struct.StableCrateId.html#method.new [`StableCrateId::new`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/def_id/struct.StableCrateId.html#method.new
@ -154,7 +153,7 @@ will also look at the [sysroot] to find dependencies.
As crates are loaded, they are kept in the [`CStore`] with the crate metadata As crates are loaded, they are kept in the [`CStore`] with the crate metadata
wrapped in the [`CrateMetadata`] struct. After resolution and expansion, the wrapped in the [`CrateMetadata`] struct. After resolution and expansion, the
`CStore` will make its way into the [`GlobalCtxt`] for the rest of `CStore` will make its way into the [`GlobalCtxt`] for the rest of the
compilation. compilation.
[name resolution]: ../name-resolution.md [name resolution]: ../name-resolution.md

View File

@ -28,6 +28,6 @@ adding a new command-line argument.
unstable-options` flag. unstable-options` flag.
[cli-docs]: https://doc.rust-lang.org/rustc/command-line-arguments.html [cli-docs]: https://doc.rust-lang.org/rustc/command-line-arguments.html
[forge guide for new options]: https://forge.rust-lang.org/compiler/new_option.html [forge guide for new options]: https://forge.rust-lang.org/compiler/proposals-and-stabilization.html#compiler-flags
[unstable book]: https://doc.rust-lang.org/nightly/unstable-book/ [unstable book]: https://doc.rust-lang.org/nightly/unstable-book/
[`parse_bool`]: https://github.com/rust-lang/rust/blob/e5335592e78354e33d798d20c04bcd677c1df62d/src/librustc_session/options.rs#L307-L313 [`parse_bool`]: https://github.com/rust-lang/rust/blob/e5335592e78354e33d798d20c04bcd677c1df62d/src/librustc_session/options.rs#L307-L313

View File

@ -89,7 +89,7 @@ filtering the search to areas you're interested in. For example:
Not all important or beginner work has issue labels. Not all important or beginner work has issue labels.
See below for how to find work that isn't labelled. See below for how to find work that isn't labelled.
[help-wanted-search]: https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Arust-lang+no%3Aassignee+label%3AE-easy%2C%22good+first+issue%22%2Cgood-first-issue%2CE-medium%2CEasy%2CE-help-wanted%2CE-mentor+-label%3AS-blocked+ [help-wanted-search]: https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Arust-lang+no%3Aassignee+label%3AE-easy%2C%22good+first+issue%22%2Cgood-first-issue%2CE-medium%2CEasy%2CE-help-wanted%2CE-mentor+-label%3AS-blocked+-linked:pr+
[Triage]: ./contributing.md#issue-triage [Triage]: ./contributing.md#issue-triage
### Recurring work ### Recurring work

View File

@ -7,8 +7,8 @@ It acts as the glue for running the various phases of the compiler in the correc
using the interface defined in the [`rustc_interface`] crate. Where possible, using [`rustc_driver`] rather than [`rustc_interface`] is recommended. using the interface defined in the [`rustc_interface`] crate. Where possible, using [`rustc_driver`] rather than [`rustc_interface`] is recommended.
The main entry point of [`rustc_driver`] is [`rustc_driver::run_compiler`][rd_rc]. The main entry point of [`rustc_driver`] is [`rustc_driver::run_compiler`][rd_rc].
This builder accepts the same command-line args as rustc as well as an implementation of [`Callbacks`][cb] and a couple of other optional options. This builder accepts the same command-line args as rustc as well as an implementation of [`Callbacks`] and a couple of other optional options.
[`Callbacks`][cb] is a `trait` that allows for custom compiler configuration, [`Callbacks`] is a `trait` that allows for custom compiler configuration,
as well as allowing custom code to run after different phases of the compilation. as well as allowing custom code to run after different phases of the compilation.
## `rustc_interface` ## `rustc_interface`
@ -33,14 +33,8 @@ specifically [`rustc_driver_impl::run_compiler`][rdi_rc]
[`Compiler`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/struct.Compiler.html [`Compiler`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/struct.Compiler.html
[`rustc_driver`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/ [`rustc_driver`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/
[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/index.html [`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/index.html
[`Session`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/struct.Session.html [`Callbacks`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/trait.Callbacks.html
[`SourceMap`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/source_map/struct.SourceMap.html
[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html
[Appendix A]: appendix/stupid-stats.html
[cb]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/trait.Callbacks.html
[example]: https://github.com/rust-lang/rustc-dev-guide/blob/master/examples/rustc-interface-example.rs [example]: https://github.com/rust-lang/rustc-dev-guide/blob/master/examples/rustc-interface-example.rs
[i_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/fn.run_compiler.html [i_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/fn.run_compiler.html
[rd_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/fn.run_compiler.html [rd_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/fn.run_compiler.html
[rdi_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver_impl/fn.run_compiler.html [rdi_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver_impl/fn.run_compiler.html
[stupid-stats]: https://github.com/nrc/stupid-stats
[`nightly-rustc`]: https://doc.rust-lang.org/nightly/nightly-rustc/