use rustc::lint::*;
use rustc::middle::const_val::ConstVal;
-use rustc::ty::TyArray;
+use rustc::ty;
use rustc_const_eval::EvalHint::ExprTypeChecked;
use rustc_const_eval::eval_const_expr_partial;
use rustc_const_math::ConstInt;
-use rustc::hir::*;
+use rustc::hir;
use syntax::ast::RangeLimits;
use utils::{self, higher};
declare_lint! {
pub OUT_OF_BOUNDS_INDEXING,
Deny,
- "out of bound constant indexing"
+ "out of bounds constant indexing"
}
/// **What it does:** Checks for usage of indexing or slicing.
}
}
-impl LateLintPass for ArrayIndexing {
- fn check_expr(&mut self, cx: &LateContext, e: &Expr) {
- if let ExprIndex(ref array, ref index) = e.node {
+impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIndexing {
+ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) {
+ if let hir::ExprIndex(ref array, ref index) = e.node {
// Array with known size can be checked statically
- let ty = cx.tcx.expr_ty(array);
- if let TyArray(_, size) = ty.sty {
+ let ty = cx.tcx.tables().expr_ty(array);
+ if let ty::TyArray(_, size) = ty.sty {
let size = ConstInt::Infer(size as u64);
// Index is a constant uint