Skip to content

Commit e81f2f9

Browse files
Rollup merge of rust-lang#99803 - JohnTitor:update-lazy-docs, r=compiler-errors
Update mentions to `rustc_metadata::rmeta::Lazy` While working on rust-lang/rustc-dev-guide#1411, I noticed there are still some mentions of `Lazy`. This updates them to `LazyValue`, `LazyArray`, or `LazyTable`. r? `@compiler-errors` Signed-off-by: Yuki Okushi <[email protected]>
2 parents 24f6d02 + 645a883 commit e81f2f9

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

compiler/rustc_metadata/src/rmeta/decoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub(crate) struct CrateMetadata {
8383

8484
// --- Some data pre-decoded from the metadata blob, usually for performance ---
8585
/// NOTE(eddyb) we pass `'static` to a `'tcx` parameter because this
86-
/// lifetime is only used behind `Lazy`, and therefore acts like a
86+
/// lifetime is only used behind `LazyValue`, `LazyArray`, or `LazyTable`, and therefore acts like a
8787
/// universal (`for<'tcx>`), that is paired up with whichever `TyCtxt`
8888
/// is being used to decode those values.
8989
root: CrateRoot,

compiler/rustc_metadata/src/rmeta/mod.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ pub const METADATA_HEADER: &[u8] = &[b'r', b'u', b's', b't', 0, 0, 0, METADATA_V
6666
///
6767
/// Metadata is effective a tree, encoded in post-order,
6868
/// and with the root's position written next to the header.
69-
/// That means every single `Lazy` points to some previous
69+
/// That means every single `LazyValue` points to some previous
7070
/// location in the metadata and is part of a larger node.
7171
///
72-
/// The first `Lazy` in a node is encoded as the backwards
72+
/// The first `LazyValue` in a node is encoded as the backwards
7373
/// distance from the position where the containing node
74-
/// starts and where the `Lazy` points to, while the rest
75-
/// use the forward distance from the previous `Lazy`.
74+
/// starts and where the `LazyValue` points to, while the rest
75+
/// use the forward distance from the previous `LazyValue`.
7676
/// Distances start at 1, as 0-byte nodes are invalid.
7777
/// Also invalid are nodes being referred in a different
7878
/// order than they were encoded in.
@@ -94,12 +94,12 @@ impl<T> LazyValue<T> {
9494

9595
/// A list of lazily-decoded values.
9696
///
97-
/// Unlike `Lazy<Vec<T>>`, the length is encoded next to the
97+
/// Unlike `LazyValue<Vec<T>>`, the length is encoded next to the
9898
/// position, not at the position, which means that the length
9999
/// doesn't need to be known before encoding all the elements.
100100
///
101101
/// If the length is 0, no position is encoded, but otherwise,
102-
/// the encoding is that of `Lazy`, with the distinction that
102+
/// the encoding is that of `LazyArray`, with the distinction that
103103
/// the minimal distance the length of the sequence, i.e.
104104
/// it's assumed there's no 0-byte element in the sequence.
105105
struct LazyArray<T> {
@@ -167,17 +167,17 @@ impl<I, T> Clone for LazyTable<I, T> {
167167
}
168168
}
169169

170-
/// Encoding / decoding state for `Lazy`.
170+
/// Encoding / decoding state for `Lazy`s (`LazyValue`, `LazyArray`, and `LazyTable`).
171171
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
172172
enum LazyState {
173173
/// Outside of a metadata node.
174174
NoNode,
175175

176-
/// Inside a metadata node, and before any `Lazy`.
176+
/// Inside a metadata node, and before any `Lazy`s.
177177
/// The position is that of the node itself.
178178
NodeStart(NonZeroUsize),
179179

180-
/// Inside a metadata node, with a previous `Lazy`.
180+
/// Inside a metadata node, with a previous `Lazy`s.
181181
/// The position is where that previous `Lazy` would start.
182182
Previous(NonZeroUsize),
183183
}

compiler/rustc_metadata/src/rmeta/table.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fixed_size_enum! {
141141
}
142142
}
143143

144-
// We directly encode `DefPathHash` because a `Lazy` would encur a 25% cost.
144+
// We directly encode `DefPathHash` because a `LazyValue` would incur a 25% cost.
145145
impl FixedSizeEncoding for Option<DefPathHash> {
146146
type ByteArray = [u8; 16];
147147

@@ -159,7 +159,7 @@ impl FixedSizeEncoding for Option<DefPathHash> {
159159
}
160160
}
161161

162-
// We directly encode RawDefId because using a `Lazy` would incur a 50% overhead in the worst case.
162+
// We directly encode RawDefId because using a `LazyValue` would incur a 50% overhead in the worst case.
163163
impl FixedSizeEncoding for Option<RawDefId> {
164164
type ByteArray = [u8; 8];
165165

0 commit comments

Comments
 (0)