Add IS_MANUALLY_DROP to AdtFlags
This commit is contained in:
parent
570c1613c1
commit
39733223fc
1 changed files with 17 additions and 5 deletions
|
|
@ -1792,19 +1792,22 @@ bitflags! {
|
|||
const IS_STRUCT = 1 << 2;
|
||||
/// Indicates whether the ADT is a struct and has a constructor.
|
||||
const HAS_CTOR = 1 << 3;
|
||||
/// Indicates whether the type is a `PhantomData`.
|
||||
/// Indicates whether the type is `PhantomData`.
|
||||
const IS_PHANTOM_DATA = 1 << 4;
|
||||
/// Indicates whether the type has a `#[fundamental]` attribute.
|
||||
const IS_FUNDAMENTAL = 1 << 5;
|
||||
/// Indicates whether the type is a `Box`.
|
||||
/// Indicates whether the type is `Box`.
|
||||
const IS_BOX = 1 << 6;
|
||||
/// Indicates whether the type is `ManuallyDrop`.
|
||||
const IS_MANUALLY_DROP = 1 << 7;
|
||||
// FIXME(matthewjasper) replace these with diagnostic items
|
||||
/// Indicates whether the type is an `Arc`.
|
||||
const IS_ARC = 1 << 7;
|
||||
const IS_ARC = 1 << 8;
|
||||
/// Indicates whether the type is an `Rc`.
|
||||
const IS_RC = 1 << 8;
|
||||
const IS_RC = 1 << 9;
|
||||
/// Indicates whether the variant list of this ADT is `#[non_exhaustive]`.
|
||||
/// (i.e., this flag is never set unless this ADT is an enum).
|
||||
const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 9;
|
||||
const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2180,6 +2183,9 @@ impl<'tcx> AdtDef {
|
|||
if Some(did) == tcx.lang_items().owned_box() {
|
||||
flags |= AdtFlags::IS_BOX;
|
||||
}
|
||||
if Some(did) == tcx.lang_items().manually_drop() {
|
||||
flags |= AdtFlags::IS_MANUALLY_DROP;
|
||||
}
|
||||
if Some(did) == tcx.lang_items().arc() {
|
||||
flags |= AdtFlags::IS_ARC;
|
||||
}
|
||||
|
|
@ -2280,6 +2286,12 @@ impl<'tcx> AdtDef {
|
|||
self.flags.contains(AdtFlags::IS_BOX)
|
||||
}
|
||||
|
||||
/// Returns `true` if this is ManuallyDrop<T>.
|
||||
#[inline]
|
||||
pub fn is_manually_drop(&self) -> bool {
|
||||
self.flags.contains(AdtFlags::IS_MANUALLY_DROP)
|
||||
}
|
||||
|
||||
/// Returns `true` if this type has a destructor.
|
||||
pub fn has_dtor(&self, tcx: TyCtxt<'tcx>) -> bool {
|
||||
self.destructor(tcx).is_some()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue