mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 13:43:17 +00:00
Rustup to rustc 1.16.0-nightly (468227129 2017-01-03): u128 fixes for rustup
This commit is contained in:
parent
64f5dbc9f8
commit
5aea0b2062
5 changed files with 10 additions and 9 deletions
|
@ -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);
|
||||
|
|
|
@ -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<u64> {
|
||||
fn fetch_int_literal(cx: &LateContext, lit: &Expr) -> Option<u128> {
|
||||
match lit.node {
|
||||
ExprLit(ref lit_ptr) => {
|
||||
if let LitKind::Int(value, _) = lit_ptr.node {
|
||||
|
|
|
@ -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, _) => {
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue