@@ -1791,19 +1791,22 @@ bitflags! {
17911791 const IS_STRUCT = 1 << 2 ;
17921792 /// Indicates whether the ADT is a struct and has a constructor.
17931793 const HAS_CTOR = 1 << 3 ;
1794- /// Indicates whether the type is a `PhantomData`.
1794+ /// Indicates whether the type is `PhantomData`.
17951795 const IS_PHANTOM_DATA = 1 << 4 ;
17961796 /// Indicates whether the type has a `#[fundamental]` attribute.
17971797 const IS_FUNDAMENTAL = 1 << 5 ;
1798- /// Indicates whether the type is a `Box`.
1798+ /// Indicates whether the type is `Box`.
17991799 const IS_BOX = 1 << 6 ;
1800+ /// Indicates whether the type is `ManuallyDrop`.
1801+ const IS_MANUALLY_DROP = 1 << 7 ;
1802+ // FIXME(matthewjasper) replace these with diagnostic items
18001803 /// Indicates whether the type is an `Arc`.
1801- const IS_ARC = 1 << 7 ;
1804+ const IS_ARC = 1 << 8 ;
18021805 /// Indicates whether the type is an `Rc`.
1803- const IS_RC = 1 << 8 ;
1806+ const IS_RC = 1 << 9 ;
18041807 /// Indicates whether the variant list of this ADT is `#[non_exhaustive]`.
18051808 /// (i.e., this flag is never set unless this ADT is an enum).
1806- const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 9 ;
1809+ const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 10 ;
18071810 }
18081811}
18091812
@@ -2179,6 +2182,9 @@ impl<'tcx> AdtDef {
21792182 if Some ( did) == tcx. lang_items ( ) . owned_box ( ) {
21802183 flags |= AdtFlags :: IS_BOX ;
21812184 }
2185+ if Some ( did) == tcx. lang_items ( ) . manually_drop ( ) {
2186+ flags |= AdtFlags :: IS_MANUALLY_DROP ;
2187+ }
21822188 if Some ( did) == tcx. lang_items ( ) . arc ( ) {
21832189 flags |= AdtFlags :: IS_ARC ;
21842190 }
@@ -2279,6 +2285,12 @@ impl<'tcx> AdtDef {
22792285 self . flags . contains ( AdtFlags :: IS_BOX )
22802286 }
22812287
2288+ /// Returns `true` if this is ManuallyDrop<T>.
2289+ #[ inline]
2290+ pub fn is_manually_drop ( & self ) -> bool {
2291+ self . flags . contains ( AdtFlags :: IS_MANUALLY_DROP )
2292+ }
2293+
22822294 /// Returns `true` if this type has a destructor.
22832295 pub fn has_dtor ( & self , tcx : TyCtxt < ' tcx > ) -> bool {
22842296 self . destructor ( tcx) . is_some ( )
0 commit comments