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