diff --git a/clippy_lints/src/array_indexing.rs b/clippy_lints/src/array_indexing.rs index de13c0264e5..f14268f9b4c 100644 --- a/clippy_lints/src/array_indexing.rs +++ b/clippy_lints/src/array_indexing.rs @@ -61,7 +61,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIndexing { // Array with known size can be checked statically let ty = cx.tcx.tables().expr_ty(array); if let ty::TyArray(_, size) = ty.sty { - let size = ConstInt::Infer(size as u64); + let size = ConstInt::Infer(size as u128); // Index is a constant uint let const_index = eval_const_expr_partial(cx.tcx, index, ExprTypeChecked, None); diff --git a/clippy_lints/src/bit_mask.rs b/clippy_lints/src/bit_mask.rs index 5b860d8cedc..1323ce29875 100644 --- a/clippy_lints/src/bit_mask.rs +++ b/clippy_lints/src/bit_mask.rs @@ -106,7 +106,7 @@ fn invert_cmp(cmp: BinOp_) -> BinOp_ { } -fn check_compare(cx: &LateContext, bit_op: &Expr, cmp_op: BinOp_, cmp_value: u64, span: &Span) { +fn check_compare(cx: &LateContext, bit_op: &Expr, cmp_op: BinOp_, cmp_value: u128, span: &Span) { if let ExprBinary(ref op, ref left, ref right) = bit_op.node { if op.node != BiBitAnd && op.node != BiBitOr { return; @@ -117,7 +117,7 @@ fn check_compare(cx: &LateContext, bit_op: &Expr, cmp_op: BinOp_, cmp_value: u64 } } -fn check_bit_mask(cx: &LateContext, bit_op: BinOp_, cmp_op: BinOp_, mask_value: u64, cmp_value: u64, span: &Span) { +fn check_bit_mask(cx: &LateContext, bit_op: BinOp_, cmp_op: BinOp_, mask_value: u128, cmp_value: u128, span: &Span) { match cmp_op { BiEq | BiNe => { match bit_op { @@ -212,7 +212,7 @@ fn check_bit_mask(cx: &LateContext, bit_op: BinOp_, cmp_op: BinOp_, mask_value: } } -fn check_ineffective_lt(cx: &LateContext, span: Span, m: u64, c: u64, op: &str) { +fn check_ineffective_lt(cx: &LateContext, span: Span, m: u128, c: u128, op: &str) { if c.is_power_of_two() && m < c { span_lint(cx, INEFFECTIVE_BIT_MASK, @@ -224,7 +224,7 @@ fn check_ineffective_lt(cx: &LateContext, span: Span, m: u64, c: u64, op: &str) } } -fn check_ineffective_gt(cx: &LateContext, span: Span, m: u64, c: u64, op: &str) { +fn check_ineffective_gt(cx: &LateContext, span: Span, m: u128, c: u128, op: &str) { if (c + 1).is_power_of_two() && m <= c { span_lint(cx, INEFFECTIVE_BIT_MASK, @@ -236,7 +236,7 @@ fn check_ineffective_gt(cx: &LateContext, span: Span, m: u64, c: u64, op: &str) } } -fn fetch_int_literal(cx: &LateContext, lit: &Expr) -> Option { +fn fetch_int_literal(cx: &LateContext, lit: &Expr) -> Option { match lit.node { ExprLit(ref lit_ptr) => { if let LitKind::Int(value, _) = lit_ptr.node { diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index cb73d419eb2..890baa64d23 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -74,7 +74,7 @@ impl PartialEq for Constant { (&Constant::Binary(ref l), &Constant::Binary(ref r)) => l == r, (&Constant::Char(l), &Constant::Char(r)) => l == r, (&Constant::Int(l), &Constant::Int(r)) => { - l.is_negative() == r.is_negative() && l.to_u64_unchecked() == r.to_u64_unchecked() + l.is_negative() == r.is_negative() && l.to_u128_unchecked() == r.to_u128_unchecked() }, (&Constant::Float(ref ls, _), &Constant::Float(ref rs, _)) => { // we want `Fw32 == FwAny` and `FwAny == Fw64`, by transitivity we must have @@ -110,7 +110,7 @@ impl Hash for Constant { c.hash(state); }, Constant::Int(i) => { - i.to_u64_unchecked().hash(state); + i.to_u128_unchecked().hash(state); i.is_negative().hash(state); }, Constant::Float(ref f, _) => { diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index ac92d5ec97b..b902d18d184 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -3,6 +3,7 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(custom_attribute)] +#![feature(i128_type)] #![feature(rustc_private)] #![feature(slice_patterns)] #![feature(stmt_expr_attributes)] diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index e9c77f027e8..102074ca15a 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -611,7 +611,7 @@ pub fn walk_ptrs_ty_depth(ty: ty::Ty) -> (ty::Ty, usize) { } /// Check whether the given expression is a constant literal of the given value. -pub fn is_integer_literal(expr: &Expr, value: u64) -> bool { +pub fn is_integer_literal(expr: &Expr, value: u128) -> bool { // FIXME: use constant folding if let ExprLit(ref spanned) = expr.node { if let LitKind::Int(v, _) = spanned.node {