@@ -1792,19 +1792,22 @@ bitflags! {
1792
1792
const IS_STRUCT = 1 << 2 ;
1793
1793
/// Indicates whether the ADT is a struct and has a constructor.
1794
1794
const HAS_CTOR = 1 << 3 ;
1795
- /// Indicates whether the type is a `PhantomData`.
1795
+ /// Indicates whether the type is `PhantomData`.
1796
1796
const IS_PHANTOM_DATA = 1 << 4 ;
1797
1797
/// Indicates whether the type has a `#[fundamental]` attribute.
1798
1798
const IS_FUNDAMENTAL = 1 << 5 ;
1799
- /// Indicates whether the type is a `Box`.
1799
+ /// Indicates whether the type is `Box`.
1800
1800
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
1801
1804
/// Indicates whether the type is an `Arc`.
1802
- const IS_ARC = 1 << 7 ;
1805
+ const IS_ARC = 1 << 8 ;
1803
1806
/// Indicates whether the type is an `Rc`.
1804
- const IS_RC = 1 << 8 ;
1807
+ const IS_RC = 1 << 9 ;
1805
1808
/// Indicates whether the variant list of this ADT is `#[non_exhaustive]`.
1806
1809
/// (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 ;
1808
1811
}
1809
1812
}
1810
1813
@@ -2180,6 +2183,9 @@ impl<'tcx> AdtDef {
2180
2183
if Some ( did) == tcx. lang_items ( ) . owned_box ( ) {
2181
2184
flags |= AdtFlags :: IS_BOX ;
2182
2185
}
2186
+ if Some ( did) == tcx. lang_items ( ) . manually_drop ( ) {
2187
+ flags |= AdtFlags :: IS_MANUALLY_DROP ;
2188
+ }
2183
2189
if Some ( did) == tcx. lang_items ( ) . arc ( ) {
2184
2190
flags |= AdtFlags :: IS_ARC ;
2185
2191
}
@@ -2280,6 +2286,12 @@ impl<'tcx> AdtDef {
2280
2286
self . flags . contains ( AdtFlags :: IS_BOX )
2281
2287
}
2282
2288
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
+
2283
2295
/// Returns `true` if this type has a destructor.
2284
2296
pub fn has_dtor ( & self , tcx : TyCtxt < ' tcx > ) -> bool {
2285
2297
self . destructor ( tcx) . is_some ( )
0 commit comments