This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
compiler/rustc_pattern_analysis/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -391,12 +391,18 @@ impl IntRange {
391391/// first.
392392impl fmt:: Debug for IntRange {
393393 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
394- if let Finite ( lo) = self . lo {
394+ if self . is_singleton ( ) {
395+ // Only finite ranges can be singletons.
396+ let Finite ( lo) = self . lo else { unreachable ! ( ) } ;
395397 write ! ( f, "{lo}" ) ?;
396- }
397- write ! ( f, "{}" , RangeEnd :: Excluded ) ?;
398- if let Finite ( hi) = self . hi {
399- write ! ( f, "{hi}" ) ?;
398+ } else {
399+ if let Finite ( lo) = self . lo {
400+ write ! ( f, "{lo}" ) ?;
401+ }
402+ write ! ( f, "{}" , RangeEnd :: Excluded ) ?;
403+ if let Finite ( hi) = self . hi {
404+ write ! ( f, "{hi}" ) ?;
405+ }
400406 }
401407 Ok ( ( ) )
402408 }
You can’t perform that action at this time.
0 commit comments