Skip to content

Commit a38ff37

Browse files
committed
Improve conservative_is_uninhabited comment
1 parent 6e5e54f commit a38ff37

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/librustc/ty/sty.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,10 +1543,14 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
15431543
}
15441544
}
15451545

1546+
/// Checks whether a type is definitely uninhabited. This is
1547+
/// conservative: for some types that are uninhabited we return `false`,
1548+
/// but we only return `true` for types that are definitely uninhabited.
1549+
/// `ty.conservative_is_uninhabited` implies that any value of type `ty`
1550+
/// will be `Abi::Uninhabited`.
15461551
pub fn conservative_is_uninhabited(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool {
1547-
// Checks whether a type is definitely uninhabited. This is
1548-
// conservative: for some types that are uninhabited we return `false`,
1549-
// but we only return `true` for types that are definitely uninhabited.
1552+
// FIXME(varkor): we can make this less conversative by substituting concrete
1553+
// type arguments.
15501554
match self.sty {
15511555
ty::Never => true,
15521556
ty::Adt(def, _) if def.is_union() => {

0 commit comments

Comments
 (0)