@@ -2,7 +2,7 @@ use itertools::Itertools;
2
2
use reexport:: * ;
3
3
use rustc:: hir:: * ;
4
4
use rustc:: hir:: def:: Def ;
5
- use rustc:: hir:: def_id;
5
+ use rustc:: hir:: def_id;
6
6
use rustc:: hir:: intravisit:: { walk_block, walk_decl, walk_expr, walk_pat, walk_stmt, NestedVisitorMap , Visitor } ;
7
7
use rustc:: hir:: map:: Node :: { NodeBlock , NodeExpr , NodeStmt } ;
8
8
use rustc:: lint:: * ;
@@ -363,7 +363,7 @@ impl LintPass for Pass {
363
363
EMPTY_LOOP ,
364
364
WHILE_LET_ON_ITERATOR ,
365
365
FOR_KV_MAP ,
366
- NEVER_LOOP ,
366
+ NEVER_LOOP ,
367
367
MUT_RANGE_BOUND
368
368
)
369
369
}
@@ -1128,7 +1128,12 @@ fn check_for_loop_arg(cx: &LateContext, pat: &Pat, arg: &Expr, expr: &Expr) {
1128
1128
let fn_arg_tys = method_type. fn_sig ( cx. tcx ) . inputs ( ) ;
1129
1129
assert_eq ! ( fn_arg_tys. skip_binder( ) . len( ) , 1 ) ;
1130
1130
if fn_arg_tys. skip_binder ( ) [ 0 ] . is_region_ptr ( ) {
1131
- lint_iter_method ( cx, args, arg, method_name) ;
1131
+ match cx. tables . expr_ty ( & args[ 0 ] ) . sty {
1132
+ // If the length is greater than 32 no traits are implemented for array and
1133
+ // therefore we cannot use `&`.
1134
+ ty:: TypeVariants :: TyArray ( _, size) if const_to_u64 ( size) > 32 => ( ) ,
1135
+ _ => lint_iter_method ( cx, args, arg, method_name)
1136
+ } ;
1132
1137
} else {
1133
1138
let object = snippet ( cx, args[ 0 ] . span , "_" ) ;
1134
1139
span_lint_and_sugg (
@@ -1319,7 +1324,7 @@ struct MutateDelegate {
1319
1324
impl < ' tcx > Delegate < ' tcx > for MutateDelegate {
1320
1325
fn consume ( & mut self , _: NodeId , _: Span , _: cmt < ' tcx > , _: ConsumeMode ) {
1321
1326
}
1322
-
1327
+
1323
1328
fn matched_pat ( & mut self , _: & Pat , _: cmt < ' tcx > , _: MatchMode ) {
1324
1329
}
1325
1330
@@ -1500,13 +1505,13 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
1500
1505
walk_expr( & mut used_visitor, idx) ;
1501
1506
used_visitor. used
1502
1507
} ;
1503
-
1508
+
1504
1509
if index_used {
1505
1510
let def = self . cx. tables. qpath_def( seqpath, seqexpr. hir_id) ;
1506
1511
match def {
1507
1512
Def :: Local ( node_id) | Def :: Upvar ( node_id, ..) => {
1508
1513
let hir_id = self . cx. tcx. hir. node_to_hir_id( node_id) ;
1509
-
1514
+
1510
1515
let parent_id = self . cx. tcx. hir. get_parent( expr. id) ;
1511
1516
let parent_def_id = self . cx. tcx. hir. local_def_id( parent_id) ;
1512
1517
let extent = self . cx. tcx. region_scope_tree( parent_def_id) . var_scope( hir_id. local_id) ;
0 commit comments