fix: Support unstable UnsafePinned struct in type layout calc

This commit is contained in:
Lukas Wirth 2025-04-21 09:35:30 +02:00
parent 66e3b5819e
commit d16b862ea5
5 changed files with 16 additions and 14 deletions

View file

@ -345,6 +345,7 @@ language_item_table! {
IndexMut, sym::index_mut, index_mut_trait, Target::Trait, GenericRequirement::Exact(1);
UnsafeCell, sym::unsafe_cell, unsafe_cell_type, Target::Struct, GenericRequirement::None;
UnsafePinned, sym::unsafe_pinned, unsafe_pinned_type, Target::Struct, GenericRequirement::None;
VaList, sym::va_list, va_list, Target::Struct, GenericRequirement::None;
Deref, sym::deref, deref_trait, Target::Trait, GenericRequirement::Exact(0);

View file

@ -62,6 +62,8 @@ bitflags! {
const IS_MANUALLY_DROP = 1 << 5;
/// Indicates whether this struct is `UnsafeCell`.
const IS_UNSAFE_CELL = 1 << 6;
/// Indicates whether this struct is `UnsafePinned`.
const IS_UNSAFE_PINNED = 1 << 7;
}
}
@ -84,6 +86,7 @@ impl StructSignature {
LangItem::OwnedBox => flags |= StructFlags::IS_BOX,
LangItem::ManuallyDrop => flags |= StructFlags::IS_MANUALLY_DROP,
LangItem::UnsafeCell => flags |= StructFlags::IS_UNSAFE_CELL,
LangItem::UnsafePinned => flags |= StructFlags::IS_UNSAFE_PINNED,
_ => (),
}
}