File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -1704,22 +1704,21 @@ impl<'tcx> TyS<'tcx> {
17041704 /// will be `Abi::Uninhabited`. (Note that uninhabited types may have nonzero
17051705 /// size, to account for partial initialisation. See #49298 for details.)
17061706 pub fn conservative_is_privately_uninhabited ( & self , tcx : TyCtxt < ' tcx > ) -> bool {
1707- // FIXME(varkor): we can make this less conversative by substituting concrete
1708- // type arguments.
17091707 match self . sty {
17101708 ty:: Never => true ,
17111709 ty:: Adt ( def, _) if def. is_union ( ) => {
17121710 // For now, `union`s are never considered uninhabited.
17131711 false
17141712 }
1715- ty:: Adt ( def, _ ) => {
1713+ ty:: Adt ( def, substs ) => {
17161714 // Any ADT is uninhabited if either:
17171715 // (a) It has no variants (i.e. an empty `enum`);
17181716 // (b) Each of its variants (a single one in the case of a `struct`) has at least
17191717 // one uninhabited field.
17201718 def. variants . iter ( ) . all ( |var| {
17211719 var. fields . iter ( ) . any ( |field| {
1722- tcx. type_of ( field. did ) . conservative_is_privately_uninhabited ( tcx)
1720+ tcx. type_of ( field. did ) . subst ( tcx, substs)
1721+ . conservative_is_privately_uninhabited ( tcx)
17231722 } )
17241723 } )
17251724 }
You can’t perform that action at this time.
0 commit comments