From 5aea0b2062bc72eab4aa6c15b674979a64d9fe0f Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Wed, 4 Jan 2017 12:05:33 -0500 Subject: [PATCH] Rustup to rustc 1.16.0-nightly (468227129 2017-01-03): u128 fixes for rustup --- clippy_lints/src/array_indexing.rs | 2 +- clippy_lints/src/bit_mask.rs | 10 +++++----- clippy_lints/src/consts.rs | 4 ++-- clippy_lints/src/lib.rs | 1 + clippy_lints/src/utils/mod.rs | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) 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 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) { // 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 @@ fn eq(&self, other: &Constant) -> bool { (&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 @@ fn hash(&self, state: &mut H) 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 @@ fn inner(ty: ty::Ty, depth: usize) -> (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 {