Fix typos in "Libraries and Metadata"

This commit is contained in:
Mahmoud Mazouz 2025-05-18 15:37:18 +02:00
parent 70e08b3d42
commit ef032e8c8d
No known key found for this signature in database
1 changed files with 13 additions and 14 deletions

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