@@ -828,7 +828,6 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
828
828
use print:: { FieldPat , Pat , PatKind } ;
829
829
let cx = self ;
830
830
let hoist = |p| Box :: new ( cx. hoist_witness_pat ( p) ) ;
831
- let mut subpatterns = pat. iter_fields ( ) . map ( hoist) ;
832
831
let kind = match pat. ctor ( ) {
833
832
Bool ( b) => PatKind :: Constant { value : mir:: Const :: from_bool ( cx. tcx , * b) } ,
834
833
IntRange ( range) => return self . hoist_pat_range ( range, * pat. ty ( ) ) ,
@@ -855,11 +854,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
855
854
856
855
PatKind :: StructLike { enum_info, subpatterns }
857
856
}
858
- // Note: given the expansion of `&str` patterns done in `expand_pattern`, we should
859
- // be careful to reconstruct the correct constant pattern here. However a string
860
- // literal pattern will never be reported as a non-exhaustiveness witness, so we
861
- // ignore this issue.
862
- Ref => PatKind :: Deref { subpattern : subpatterns. next ( ) . unwrap ( ) } ,
857
+ Ref => PatKind :: Deref { subpattern : hoist ( & pat. fields [ 0 ] ) } ,
863
858
Slice ( slice) => {
864
859
let ( prefix_len, has_dot_dot) = match slice. kind {
865
860
SliceKind :: FixedLen ( len) => ( len, false ) ,
0 commit comments