@@ -784,7 +784,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
784
784
} else if range. is_singleton ( ) {
785
785
let lo = cx. hoist_pat_range_bdy ( range. lo , ty) ;
786
786
let value = lo. as_finite ( ) . unwrap ( ) ;
787
- PatKind :: Constant { value }
787
+ PatKind :: Print ( value. to_string ( ) )
788
788
} else {
789
789
// We convert to an inclusive range for diagnostics.
790
790
let mut end = rustc_hir:: RangeEnd :: Included ;
@@ -827,7 +827,8 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
827
827
let cx = self ;
828
828
let hoist = |p| Box :: new ( cx. hoist_witness_pat ( p) ) ;
829
829
let kind = match pat. ctor ( ) {
830
- Bool ( b) => PatKind :: Constant { value : mir:: Const :: from_bool ( cx. tcx , * b) } ,
830
+ Bool ( b) => PatKind :: Print ( b. to_string ( ) ) ,
831
+ Str ( s) => PatKind :: Print ( s. to_string ( ) ) ,
831
832
IntRange ( range) => return self . hoist_pat_range ( range, * pat. ty ( ) ) ,
832
833
Struct if pat. ty ( ) . is_box ( ) => {
833
834
// Outside of the `alloc` crate, the only way to create a struct pattern
@@ -901,7 +902,6 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
901
902
902
903
PatKind :: Slice { prefix, has_dot_dot, suffix }
903
904
}
904
- & Str ( value) => PatKind :: Constant { value } ,
905
905
Never if self . tcx . features ( ) . never_patterns => PatKind :: Never ,
906
906
Never | Wildcard | NonExhaustive | Hidden | PrivateUninhabited => {
907
907
PatKind :: Print ( "_" . to_string ( ) )
0 commit comments