Skip to content

Commit 39d09eb

Browse files
committed
Rewrite the comment on is_multivariant_adt
As Nadrieril remarked, the previous comment was misleadingly framed.
1 parent a625b77 commit 39d09eb

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
@@ -1859,9 +1859,14 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
18591859
/// builder code does a more specific check, filtering out variants that
18601860
/// happen to be uninhabited.
18611861
///
1862-
/// Here, we cannot perform such an accurate checks, because querying
1863-
/// whether a type is inhabited requires that it has been fully inferred,
1864-
/// which cannot be guaranteed at this point.
1862+
/// Here, it is not practical to perform such a check, because inhabitedness
1863+
/// queries require typeck results, and typeck requires closure capture analysis.
1864+
///
1865+
/// Moreover, the language is moving towards uninhabited variants still semantically
1866+
/// causing a discriminant read, so we *shouldn't* perform any such check.
1867+
///
1868+
/// FIXME(never_patterns): update this comment once the aforementioned MIR builder
1869+
/// code is changed to be insensitive to inhhabitedness.
18651870
#[instrument(skip(self, span), level = "debug")]
18661871
fn is_multivariant_adt(&self, ty: Ty<'tcx>, span: Span) -> bool {
18671872
if let ty::Adt(def, _) = self.cx.structurally_resolve_type(span, ty).kind() {

0 commit comments

Comments
 (0)