Skip to content

Commit deba7c0

Browse files
committed
Rewrite the comment on is_multivariant_adt
As Nadrieril remarked, the previous comment was misleadingly framed.
1 parent 19b3f2e commit deba7c0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,9 +1839,14 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
18391839
/// builder code does a more specific check, filtering out variants that
18401840
/// happen to be uninhabited.
18411841
///
1842-
/// Here, we cannot perform such an accurate checks, because querying
1843-
/// whether a type is inhabited requires that it has been fully inferred,
1844-
/// which cannot be guaranteed at this point.
1842+
/// Here, it is not practical to perform such a check, because inhabitedness
1843+
/// queries require typeck results, and typeck requires closure capture analysis.
1844+
///
1845+
/// Moreover, the language is moving towards uninhabited variants still semantically
1846+
/// causing a discriminant read, so we *shouldn't* perform any such check.
1847+
///
1848+
/// FIXME(never_patterns): update this comment once the aforementioned MIR builder
1849+
/// code is changed to be insensitive to inhhabitedness.
18451850
#[instrument(skip(self, span), level = "debug")]
18461851
fn is_multivariant_adt(&self, ty: Ty<'tcx>, span: Span) -> bool {
18471852
if let ty::Adt(def, _) = self.cx.structurally_resolve_type(span, ty).kind() {

0 commit comments

Comments
 (0)