@@ -59,6 +59,8 @@ bitflags::bitflags! {
5959 const IS_PIN = 1 << 11 ;
6060 /// Indicates whether the type is `#[pin_project]`.
6161 const IS_PIN_PROJECT = 1 << 12 ;
62+ /// Indicates whether the type is `MaybeUninit`.
63+ const IS_MAYBE_UNINIT = 1 << 13 ;
6264 }
6365}
6466rustc_data_structures:: external_bitflags_debug! { AdtFlags }
@@ -224,6 +226,10 @@ impl<'tcx> rustc_type_ir::inherent::AdtDef<TyCtxt<'tcx>> for AdtDef<'tcx> {
224226 self . is_manually_drop ( )
225227 }
226228
229+ fn is_maybe_uninit ( self ) -> bool {
230+ self . is_maybe_uninit ( )
231+ }
232+
227233 fn all_field_tys (
228234 self ,
229235 tcx : TyCtxt < ' tcx > ,
@@ -315,6 +321,9 @@ impl AdtDefData {
315321 if tcx. is_lang_item ( did, LangItem :: ManuallyDrop ) {
316322 flags |= AdtFlags :: IS_MANUALLY_DROP ;
317323 }
324+ if tcx. is_lang_item ( did, LangItem :: MaybeUninit ) {
325+ flags |= AdtFlags :: IS_MAYBE_UNINIT ;
326+ }
318327 if tcx. is_lang_item ( did, LangItem :: UnsafeCell ) {
319328 flags |= AdtFlags :: IS_UNSAFE_CELL ;
320329 }
@@ -439,6 +448,12 @@ impl<'tcx> AdtDef<'tcx> {
439448 self . flags ( ) . contains ( AdtFlags :: IS_MANUALLY_DROP )
440449 }
441450
451+ /// Returns `true` if this is `ManuallyDrop<T>`.
452+ #[ inline]
453+ pub fn is_maybe_uninit ( self ) -> bool {
454+ self . flags ( ) . contains ( AdtFlags :: IS_MAYBE_UNINIT )
455+ }
456+
442457 /// Returns `true` if this is `Pin<T>`.
443458 #[ inline]
444459 pub fn is_pin ( self ) -> bool {
0 commit comments