Skip to content

Commit 4081358

Browse files
committed
ExprUseVisitor: resolve a FIXME – it's fine as is
1 parent 420eae0 commit 4081358

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,10 +929,12 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
929929
// When matching against a literal or range, we need to
930930
// borrow the place to compare it against the pattern.
931931
//
932+
// Note that we do this read even if the range matches all
933+
// possible values, such as 0..=u8::MAX. This is because
934+
// we don't want to depend on consteval here.
935+
//
932936
// FIXME: What if the type being matched only has one
933937
// possible value?
934-
// FIXME: What if the range is the full range of the type
935-
// and doesn't actually require a discriminant read?
936938
read_discriminant();
937939
}
938940
PatKind::Struct(..) | PatKind::TupleStruct(..) => {

0 commit comments

Comments
 (0)