From a38ff377e7420d33fb67349fdcda3fe9fde329d1 Mon Sep 17 00:00:00 2001 From: varkor Date: Fri, 19 Oct 2018 15:09:07 +0100 Subject: [PATCH] Improve `conservative_is_uninhabited` comment --- src/librustc/ty/sty.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 0c859dea8da9..3dab7f4dd777 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -1543,10 +1543,14 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } + /// Checks whether a type is definitely uninhabited. This is + /// conservative: for some types that are uninhabited we return `false`, + /// but we only return `true` for types that are definitely uninhabited. + /// `ty.conservative_is_uninhabited` implies that any value of type `ty` + /// will be `Abi::Uninhabited`. pub fn conservative_is_uninhabited(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool { - // Checks whether a type is definitely uninhabited. This is - // conservative: for some types that are uninhabited we return `false`, - // but we only return `true` for types that are definitely uninhabited. + // FIXME(varkor): we can make this less conversative by substituting concrete + // type arguments. match self.sty { ty::Never => true, ty::Adt(def, _) if def.is_union() => {