4

Split out the various responsibilities of `rustc_metadata::Lazy` by compiler-err...

 1 year ago
source link: https://github.com/rust-lang/rust/pull/97291
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Contributor

@compiler-errors compiler-errors commented 10 days ago

Lazy<T> actually acts like three different types -- a pointer in the crate metadata to a single value, a pointer to a list/array of values, and an indexable pointer of a list of values (a table).

We currently overload Lazy<T> to work differently than Lazy<[T]> and the same for Lazy<Table<I, T>>. All is well with some helper adapter traits such as LazyQueryDecodable and EncodeContentsForLazy.

Well, changes in #97287 that make Lazy work with the now invariant lifetime 'tcx make these adapters fall apart because of coherence reasons. So we split out these three types and rework some of the helper traits so it's both 1. more clear to understand, and 2. compatible with the changes later in that PR.

Split out from #97287 so it can be reviewed separately, since this PR stands on its own.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK