@@ -784,7 +784,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
784784 } else if range. is_singleton ( ) {
785785 let lo = cx. hoist_pat_range_bdy ( range. lo , ty) ;
786786 let value = lo. as_finite ( ) . unwrap ( ) ;
787- PatKind :: Constant { value }
787+ PatKind :: Print ( value. to_string ( ) )
788788 } else {
789789 // We convert to an inclusive range for diagnostics.
790790 let mut end = rustc_hir:: RangeEnd :: Included ;
@@ -827,7 +827,8 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
827827 let cx = self ;
828828 let hoist = |p| Box :: new ( cx. hoist_witness_pat ( p) ) ;
829829 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 ( ) ) ,
831832 IntRange ( range) => return self . hoist_pat_range ( range, * pat. ty ( ) ) ,
832833 Struct if pat. ty ( ) . is_box ( ) => {
833834 // Outside of the `alloc` crate, the only way to create a struct pattern
@@ -901,7 +902,6 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
901902
902903 PatKind :: Slice { prefix, has_dot_dot, suffix }
903904 }
904- & Str ( value) => PatKind :: Constant { value } ,
905905 Never if self . tcx . features ( ) . never_patterns => PatKind :: Never ,
906906 Never | Wildcard | NonExhaustive | Hidden | PrivateUninhabited => {
907907 PatKind :: Print ( "_" . to_string ( ) )
0 commit comments