From 101376ccb757d94ee0c6adcc127d3e920c442a9e Mon Sep 17 00:00:00 2001 From: varkor Date: Fri, 28 Dec 2018 10:59:40 +0000 Subject: [PATCH] Update range pattern refutability Range patterns may now be irrefutable, as of `exhaustive_integer_patterns`. --- src/patterns.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/patterns.md b/src/patterns.md index bd881b13c..0125b282d 100644 --- a/src/patterns.md +++ b/src/patterns.md @@ -418,9 +418,12 @@ println!("{}", match 0xfacade { }); ``` -Range patterns are always refutable, even when they cover the complete set -of possible values of a type. For example, `0u8..=255u8` is refutable even though -it covers all possible values of `u8`. +Range patterns for (non-`usize` and -`isize`) integer and `char` types are irrefutable +when they span the entire set of possible values of a type. For example, `0u8..=255u8` +is irrefutable. The range of values for an integer type is the closed range from its +minimum to maximum value. The range of values for a `char` type are precisely those +ranges containing all Unicode Scalar Values: `'\u{0000}'..='\u{D7FF}'` and +`'\u{E000}'..='\u{10FFFF}'`. ## Reference patterns