@@ -1792,19 +1792,22 @@ bitflags! {
17921792 const IS_STRUCT = 1 << 2 ;
17931793 /// Indicates whether the ADT is a struct and has a constructor.
17941794 const HAS_CTOR = 1 << 3 ;
1795- /// Indicates whether the type is a `PhantomData`.
1795+ /// Indicates whether the type is `PhantomData`.
17961796 const IS_PHANTOM_DATA = 1 << 4 ;
17971797 /// Indicates whether the type has a `#[fundamental]` attribute.
17981798 const IS_FUNDAMENTAL = 1 << 5 ;
1799- /// Indicates whether the type is a `Box`.
1799+ /// Indicates whether the type is `Box`.
18001800 const IS_BOX = 1 << 6 ;
1801+ /// Indicates whether the type is `ManuallyDrop`.
1802+ const IS_MANUALLY_DROP = 1 << 7 ;
1803+ // FIXME(matthewjasper) replace these with diagnostic items
18011804 /// Indicates whether the type is an `Arc`.
1802- const IS_ARC = 1 << 7 ;
1805+ const IS_ARC = 1 << 8 ;
18031806 /// Indicates whether the type is an `Rc`.
1804- const IS_RC = 1 << 8 ;
1807+ const IS_RC = 1 << 9 ;
18051808 /// Indicates whether the variant list of this ADT is `#[non_exhaustive]`.
18061809 /// (i.e., this flag is never set unless this ADT is an enum).
1807- const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 9 ;
1810+ const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 10 ;
18081811 }
18091812}
18101813
@@ -2180,6 +2183,9 @@ impl<'tcx> AdtDef {
21802183 if Some ( did) == tcx. lang_items ( ) . owned_box ( ) {
21812184 flags |= AdtFlags :: IS_BOX ;
21822185 }
2186+ if Some ( did) == tcx. lang_items ( ) . manually_drop ( ) {
2187+ flags |= AdtFlags :: IS_MANUALLY_DROP ;
2188+ }
21832189 if Some ( did) == tcx. lang_items ( ) . arc ( ) {
21842190 flags |= AdtFlags :: IS_ARC ;
21852191 }
@@ -2280,6 +2286,12 @@ impl<'tcx> AdtDef {
22802286 self . flags . contains ( AdtFlags :: IS_BOX )
22812287 }
22822288
2289+ /// Returns `true` if this is ManuallyDrop<T>.
2290+ #[ inline]
2291+ pub fn is_manually_drop ( & self ) -> bool {
2292+ self . flags . contains ( AdtFlags :: IS_MANUALLY_DROP )
2293+ }
2294+
22832295 /// Returns `true` if this type has a destructor.
22842296 pub fn has_dtor ( & self , tcx : TyCtxt < ' tcx > ) -> bool {
22852297 self . destructor ( tcx) . is_some ( )
0 commit comments