From eccd80f6086684bd805ca2a68a8ab1526dff3882 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 27 Jul 2022 07:25:55 +0900 Subject: [PATCH 1/5] Fix the link to `Lazy` Signed-off-by: Yuki Okushi --- src/serialization.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/serialization.md b/src/serialization.md index d28df6ec1..5d8434b55 100644 --- a/src/serialization.md +++ b/src/serialization.md @@ -123,22 +123,22 @@ is in the cache, then instead of serializing the type as usual, the byte offset within the file being written is encoded instead. A similar scheme is used for `ty::Predicate`. -## `Lazy` +## `LazyValue` Crate metadata is initially loaded before the `TyCtxt<'tcx>` is created, so some deserialization needs to be deferred from the initial loading of metadata. -The [`Lazy`] type wraps the (relative) offset in the crate metadata where a -`T` has been serialized. +The [`LazyValue`] type wraps the (relative) offset in the crate metadata where a +`T` has been serialized. There are also some variants, [`LazyArray`] and [`LazyTable`]. -The `Lazy<[T]>` and `Lazy>` type provide some functionality over +The `Lazy<[T]>` and `LazyTable` type provide some functionality over `Lazy>` and `Lazy>`: -- It's possible to encode a `Lazy<[T]>` directly from an iterator, without +- It's possible to encode a `LazyArray` directly from an iterator, without first collecting into a `Vec`. -- Indexing into a `Lazy>` does not require decoding entries other +- Indexing into a `LazyTable` does not require decoding entries other than the one being read. -**note**: `Lazy` does not cache its value after being deserialized the first +**note**: `LazyValue` does not cache its value after being deserialized the first time. Instead the query system is the main way of caching these results. ## Specialization @@ -155,7 +155,9 @@ for `Encodable`. [serialize]: https://en.wikipedia.org/wiki/Serialization [`CrateInfo`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/struct.CrateInfo.html -[`Lazy`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/struct.Lazy.html +[`LazyArray`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/struct.LazyValue.html +[`LazyTable`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/struct.LazyValue.html +[`LazyValue`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/struct.LazyValue.html [`RefDecodable`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/codec/trait.RefDecodable.html [`rustc_metadata::rmeta::decoder::DecodeContext`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/decoder/struct.DecodeContext.html [`rustc_metadata::rmeta::encoder::EncodeContext`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/encoder/struct.EncodeContext.html From 05c5fe471d848e69882f0fc1e1ffb853aa0b996a Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 27 Jul 2022 07:35:12 +0900 Subject: [PATCH 2/5] Fix the link to `ProcMacro` trait Signed-off-by: Yuki Okushi --- src/macro-expansion.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macro-expansion.md b/src/macro-expansion.md index 9b0f353d1..156df8d5f 100644 --- a/src/macro-expansion.md +++ b/src/macro-expansion.md @@ -427,12 +427,12 @@ Some important data structures/interfaces here: - [`SyntaxExtensionKind`] - expander functions may have several different signatures (take one token stream, or two, or a piece of AST, etc). This is an enum that lists them. -- [`ProcMacro`]/[`TTMacroExpander`]/[`AttrProcMacro`]/[`MultiItemModifier`] - +- [`BangProcMacro`]/[`TTMacroExpander`]/[`AttrProcMacro`]/[`MultiItemModifier`] - traits representing the expander function signatures. [`SyntaxExtension`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/struct.SyntaxExtension.html [`SyntaxExtensionKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/enum.SyntaxExtensionKind.html -[`ProcMacro`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/trait.ProcMacro.html +[`BangProcMacro`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/trait.BangProcMacro.html [`TTMacroExpander`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/trait.TTMacroExpander.html [`AttrProcMacro`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/trait.AttrProcMacro.html [`MultiItemModifier`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/trait.MultiItemModifier.html From 2807d77840fbec4876e12a78f531a3b2360c5b69 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 27 Jul 2022 07:35:29 +0900 Subject: [PATCH 3/5] Fix the link to `ResolverAstLowering` Signed-off-by: Yuki Okushi --- src/name-resolution.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/name-resolution.md b/src/name-resolution.md index 1cef7d08f..c4f44909b 100644 --- a/src/name-resolution.md +++ b/src/name-resolution.md @@ -45,7 +45,7 @@ namespaces and therefore can co-exist. The name resolution in Rust is a two-phase process. In the first phase, which runs during macro expansion, we build a tree of modules and resolve imports. Macro expansion and name resolution communicate with each other via the -[`ResolverAstLowering`] trait. +[`ResolverAstLoweringExt`] trait. The input to the second phase is the syntax tree, produced by parsing input files and expanding macros. This phase produces links from all the names in the @@ -61,7 +61,7 @@ The name resolution lives in the `rustc_resolve` crate, with the meat in `lib.rs` and some helpers or symbol-type specific logic in the other modules. [`Resolver::resolve_crate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_resolve/struct.Resolver.html#method.resolve_crate -[`ResolverAstLowering`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/trait.ResolverAstLowering.html +[`ResolverAstLoweringExt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/trait.ResolverAstLoweringExt.html ## Namespaces From 3a42cdd5ec8922354f943d964e47d55630d96a7d Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 27 Jul 2022 07:35:45 +0900 Subject: [PATCH 4/5] Fix the link to clippy docs Signed-off-by: Yuki Okushi --- src/diagnostics/diagnostic-items.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diagnostics/diagnostic-items.md b/src/diagnostics/diagnostic-items.md index 0031ba284..b6b6e0fa9 100644 --- a/src/diagnostics/diagnostic-items.md +++ b/src/diagnostics/diagnostic-items.md @@ -142,6 +142,6 @@ who really want to take a deep dive into the topic :) [`TyCtxt::associated_items()`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.associated_items [`AssocItems`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/assoc/struct.AssocItems.html [`clippy_utils::ty::get_iterator_item_ty()`]: https://github.com/rust-lang/rust-clippy/blob/305177342fbc622c0b3cb148467bab4b9524c934/clippy_utils/src/ty.rs#L55-L72 -[clippy-Common-tools-for-writing-lints]: https://github.com/rust-lang/rust-clippy/blob/master/doc/common_tools_writing_lints.md +[clippy-Common-tools-for-writing-lints]: https://doc.rust-lang.org/nightly/clippy/development/common_tools_writing_lints.html [rust#60966]: https://github.com/rust-lang/rust/pull/60966 [rust-clippy#5393]: https://github.com/rust-lang/rust-clippy/issues/5393 From d8fb9d52eaf26385e3e0a47e99ea9f82741e80a0 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 27 Jul 2022 07:40:07 +0900 Subject: [PATCH 5/5] Prefer relative links Signed-off-by: Yuki Okushi --- src/building/how-to-build-and-run.md | 4 ++-- src/mir/optimizations.md | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/building/how-to-build-and-run.md b/src/building/how-to-build-and-run.md index 37ad5a448..172f81ef9 100644 --- a/src/building/how-to-build-and-run.md +++ b/src/building/how-to-build-and-run.md @@ -63,7 +63,7 @@ If you set `download-ci-llvm = true`, in some circumstances, such as when updating the version of LLVM used by `rustc`, you may want to temporarily disable this feature. See the ["Updating LLVM" section] for more. -["Updating LLVM" section]: /backend/updating-llvm.md#feature-updates +["Updating LLVM" section]: ../backend/updating-llvm.md#feature-updates If you have already built `rustc` and you change settings related to LLVM, then you may have to execute `rm -rf build` for subsequent configuration changes to take effect. Note that `./x.py @@ -254,7 +254,7 @@ For examples of the complete configuration necessary to build a target, please v select any target under the "Platform Support" heading on the left, and see the section related to building a compiler for that target. For targets without a corresponding page in the rustc book, -it may be useful to [inspect the Dockerfiles](/tests/docker.md) +it may be useful to [inspect the Dockerfiles](../tests/docker.md) that the Rust infrastructure itself uses to set up and configure cross-compilation. If you have followed the directions from the prior section on creating a rustup toolchain, diff --git a/src/mir/optimizations.md b/src/mir/optimizations.md index aa0a62fb0..cef785ea9 100644 --- a/src/mir/optimizations.md +++ b/src/mir/optimizations.md @@ -8,8 +8,8 @@ to do, so compilation is faster. Note that since MIR is generic (not effective; we can optimize the generic version, so all of the monomorphizations are cheaper! -[mir]: /mir/index.md -[monomorph]: /appendix/glossary.md#mono +[mir]: ../mir/index.md +[monomorph]: ../appendix/glossary.md#mono MIR optimizations run after borrow checking. We run a series of optimization passes over the MIR to improve it. Some passes are required to run on all code, @@ -22,9 +22,9 @@ run and that some validation has occurred. Then, it [steals][steal] the MIR, optimizes it, and returns the improved MIR. [optmir]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/fn.optimized_mir.html -[query]: /query.md -[defid]: /appendix/glossary.md#def-id -[steal]: /mir/passes.md#stealing +[query]: ../query.md +[defid]: ../appendix/glossary.md#def-id +[steal]: ../mir/passes.md#stealing ## Quickstart for adding a new optimization