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