@@ -1223,7 +1223,7 @@ fn check_for_loop_arg(cx: &LateContext, pat: &Pat, arg: &Expr, expr: &Expr) {
12231223 match cx. tables . expr_ty ( & args[ 0 ] ) . sty {
12241224 // If the length is greater than 32 no traits are implemented for array and
12251225 // therefore we cannot use `&`.
1226- ty:: TypeVariants :: TyArray ( _, size) if size. val . to_raw_bits ( ) . expect ( "array size" ) > 32 => ( ) ,
1226+ ty:: TypeVariants :: TyArray ( _, size) if size. assert_usize ( cx . tcx ) . expect ( "array size" ) > 32 => ( ) ,
12271227 _ => lint_iter_method ( cx, args, arg, method_name) ,
12281228 } ;
12291229 } else {
@@ -1784,7 +1784,7 @@ fn is_ref_iterable_type(cx: &LateContext, e: &Expr) -> bool {
17841784 // no walk_ptrs_ty: calling iter() on a reference can make sense because it
17851785 // will allow further borrows afterwards
17861786 let ty = cx. tables . expr_ty ( e) ;
1787- is_iterable_array ( ty) ||
1787+ is_iterable_array ( ty, cx ) ||
17881788 match_type ( cx, ty, & paths:: VEC ) ||
17891789 match_type ( cx, ty, & paths:: LINKED_LIST ) ||
17901790 match_type ( cx, ty, & paths:: HASHMAP ) ||
@@ -1795,10 +1795,10 @@ fn is_ref_iterable_type(cx: &LateContext, e: &Expr) -> bool {
17951795 match_type ( cx, ty, & paths:: BTREESET )
17961796}
17971797
1798- fn is_iterable_array ( ty : Ty ) -> bool {
1798+ fn is_iterable_array ( ty : Ty , cx : & LateContext ) -> bool {
17991799 // IntoIterator is currently only implemented for array sizes <= 32 in rustc
18001800 match ty. sty {
1801- ty:: TyArray ( _, n) => ( 0 ..=32 ) . contains ( & n. val . to_raw_bits ( ) . expect ( "array length" ) ) ,
1801+ ty:: TyArray ( _, n) => ( 0 ..=32 ) . contains ( & n. assert_usize ( cx . tcx ) . expect ( "array length" ) ) ,
18021802 _ => false ,
18031803 }
18041804}
0 commit comments