@@ -11,7 +11,7 @@ use rustc_hir::def::{DefKind, Res};
11
11
use rustc_hir:: intravisit:: { Visitor , walk_pat} ;
12
12
use rustc_hir:: { Arm , Expr , ExprKind , HirId , Node , Pat , PatKind , QPath , StmtKind } ;
13
13
use rustc_lint:: LateContext ;
14
- use rustc_middle:: ty:: { self , AdtDef , ParamEnv , TyCtxt , TypeckResults , VariantDef } ;
14
+ use rustc_middle:: ty:: { self , AdtDef , TyCtxt , TypeckResults , VariantDef } ;
15
15
use rustc_span:: { Span , sym} ;
16
16
17
17
use super :: { MATCH_BOOL , SINGLE_MATCH , SINGLE_MATCH_ELSE } ;
@@ -67,7 +67,6 @@ pub(crate) fn check<'tcx>(cx: &LateContext<'tcx>, ex: &'tcx Expr<'_>, arms: &'tc
67
67
if v. has_enum {
68
68
let cx = PatCtxt {
69
69
tcx : cx. tcx ,
70
- param_env : cx. param_env ,
71
70
typeck,
72
71
arena : DroplessArena :: default ( ) ,
73
72
} ;
@@ -185,7 +184,6 @@ impl<'tcx> Visitor<'tcx> for PatVisitor<'tcx> {
185
184
/// The context needed to manipulate a `PatState`.
186
185
struct PatCtxt < ' tcx > {
187
186
tcx : TyCtxt < ' tcx > ,
188
- param_env : ParamEnv < ' tcx > ,
189
187
typeck : & ' tcx TypeckResults < ' tcx > ,
190
188
arena : DroplessArena ,
191
189
}
@@ -334,7 +332,7 @@ impl<'a> PatState<'a> {
334
332
if match * cx. typeck . pat_ty ( pat) . peel_refs ( ) . kind ( ) {
335
333
ty:: Adt ( adt, _) => adt. is_enum ( ) || ( adt. is_struct ( ) && !adt. non_enum_variant ( ) . fields . is_empty ( ) ) ,
336
334
ty:: Tuple ( tys) => !tys. is_empty ( ) ,
337
- ty:: Array ( _, len) => len. try_eval_target_usize ( cx. tcx , cx . param_env ) != Some ( 1 ) ,
335
+ ty:: Array ( _, len) => len. try_to_target_usize ( cx. tcx ) != Some ( 1 ) ,
338
336
ty:: Slice ( ..) => true ,
339
337
_ => false ,
340
338
} =>
@@ -353,7 +351,7 @@ impl<'a> PatState<'a> {
353
351
} ,
354
352
PatKind :: Slice ( [ sub_pat] , _, [ ] ) | PatKind :: Slice ( [ ] , _, [ sub_pat] )
355
353
if let ty:: Array ( _, len) = * cx. typeck . pat_ty ( pat) . kind ( )
356
- && len. try_eval_target_usize ( cx. tcx , cx . param_env ) == Some ( 1 ) =>
354
+ && len. try_to_target_usize ( cx. tcx ) == Some ( 1 ) =>
357
355
{
358
356
self . add_pat ( cx, sub_pat)
359
357
} ,
0 commit comments