rust/compiler/rustc_metadata/src
Nicholas Nethercote 4f008e06c3 Clarify Layout interning.
`Layout` is another type that is sometimes interned, sometimes not, and
we always use references to refer to it so we can't take any advantage
of the uniqueness properties for hashing or equality checks.

This commit renames `Layout` as `LayoutS`, and then introduces a new
`Layout` that is a newtype around an `Interned<LayoutS>`. It also
interns more layouts than before. Previously layouts within layouts
(via the `variants` field) were never interned, but now they are. Hence
the lifetime on the new `Layout` type.

Unlike other interned types, these ones are in `rustc_target` instead of
`rustc_middle`. This reflects the existing structure of the code, which
does layout-specific stuff in `rustc_target` while `TyAndLayout` is
generic over the `Ty`, allowing the type-specific stuff to occur in
`rustc_middle`.

The commit also adds a `HashStable` impl for `Interned`, which was
needed. It hashes the contents, unlike the `Hash` impl which hashes the
pointer.
2022-03-07 13:41:47 +11:00
..
rmeta Rollup merge of #94057 - lcnr:simplify_type-uwu, r=nikomatsakis 2022-03-03 20:01:44 +01:00
creader.rs Adopt let else in more places 2022-02-19 17:27:43 +01:00
dependency_format.rs
foreign_modules.rs Adopt let else in more places 2022-02-19 17:27:43 +01:00
lib.rs Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
locator.rs Adopt let else in more places 2022-02-19 17:27:43 +01:00
native_libs.rs Clarify Layout interning. 2022-03-07 13:41:47 +11:00