1
Fork 0

Rollup merge of #135383 - BoxyUwU:cov_tag_ptr, r=compiler-errors

De-abstract tagged ptr and make it covariant

In #135272 I needed to use a tagged ptr in `hir::TyKind` in order to not regress hir type sizes. Unfortunately the existing `CopyTaggedPtr` abstraction is insufficient as it makes the `'hir` lifetime invariant.

I spent some time trying to keep existing functionality while making it covariant but in the end I realised that actually we dont use *any* of this code *anywhere* in rustc, so I've just removed everything and replaced it with a much less general abstraction that is suitable for what I need in #135272.

Idk if anyone has a preference for just keeping all the abstractions here in case anyone needs them in the future 🤷‍♀️
This commit is contained in:
Guillaume Gomez 2025-01-12 23:08:58 +01:00 committed by GitHub
commit fad3039124
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 309 additions and 1003 deletions

View file

@ -21,7 +21,7 @@ use crate::arena::Arena;
/// pointer.
/// - Because of this, you cannot get a `List<T>` that is a sub-list of another
/// `List<T>`. You can get a sub-slice `&[T]`, however.
/// - `List<T>` can be used with `CopyTaggedPtr`, which is useful within
/// - `List<T>` can be used with `TaggedRef`, which is useful within
/// structs whose size must be minimized.
/// - Because of the uniqueness assumption, we can use the address of a
/// `List<T>` for faster equality comparisons and hashing.