Skip to content

Commit 5bcb36b

Browse files
authored
Merge pull request #489 from varkor/range-pattern-refutability
Update range pattern refutability
2 parents e5751c9 + 101376c commit 5bcb36b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/patterns.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,12 @@ println!("{}", match 0xfacade {
418418
});
419419
```
420420

421-
Range patterns are always refutable, even when they cover the complete set
422-
of possible values of a type. For example, `0u8..=255u8` is refutable even though
423-
it covers all possible values of `u8`.
421+
Range patterns for (non-`usize` and -`isize`) integer and `char` types are irrefutable
422+
when they span the entire set of possible values of a type. For example, `0u8..=255u8`
423+
is irrefutable. The range of values for an integer type is the closed range from its
424+
minimum to maximum value. The range of values for a `char` type are precisely those
425+
ranges containing all Unicode Scalar Values: `'\u{0000}'..='\u{D7FF}'` and
426+
`'\u{E000}'..='\u{10FFFF}'`.
424427

425428
## Reference patterns
426429

0 commit comments

Comments
 (0)