1
Fork 0

Rustup to rustc 1.16.0-nightly (468227129 2017-01-03): u128 fixes for rustup

This commit is contained in:
Josh Holmer 2017-01-04 12:05:33 -05:00 committed by Manish Goregaokar
parent 64f5dbc9f8
commit 5aea0b2062
5 changed files with 10 additions and 9 deletions

View file

@ -61,7 +61,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIndexing {
// Array with known size can be checked statically // Array with known size can be checked statically
let ty = cx.tcx.tables().expr_ty(array); let ty = cx.tcx.tables().expr_ty(array);
if let ty::TyArray(_, size) = ty.sty { 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 // Index is a constant uint
let const_index = eval_const_expr_partial(cx.tcx, index, ExprTypeChecked, None); let const_index = eval_const_expr_partial(cx.tcx, index, ExprTypeChecked, None);

View file

@ -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 let ExprBinary(ref op, ref left, ref right) = bit_op.node {
if op.node != BiBitAnd && op.node != BiBitOr { if op.node != BiBitAnd && op.node != BiBitOr {
return; 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 { match cmp_op {
BiEq | BiNe => { BiEq | BiNe => {
match bit_op { 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 { if c.is_power_of_two() && m < c {
span_lint(cx, span_lint(cx,
INEFFECTIVE_BIT_MASK, 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 { if (c + 1).is_power_of_two() && m <= c {
span_lint(cx, span_lint(cx,
INEFFECTIVE_BIT_MASK, 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 { match lit.node {
ExprLit(ref lit_ptr) => { ExprLit(ref lit_ptr) => {
if let LitKind::Int(value, _) = lit_ptr.node { if let LitKind::Int(value, _) = lit_ptr.node {

View file

@ -74,7 +74,7 @@ impl PartialEq for Constant {
(&Constant::Binary(ref l), &Constant::Binary(ref r)) => l == r, (&Constant::Binary(ref l), &Constant::Binary(ref r)) => l == r,
(&Constant::Char(l), &Constant::Char(r)) => l == r, (&Constant::Char(l), &Constant::Char(r)) => l == r,
(&Constant::Int(l), &Constant::Int(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, _)) => { (&Constant::Float(ref ls, _), &Constant::Float(ref rs, _)) => {
// we want `Fw32 == FwAny` and `FwAny == Fw64`, by transitivity we must have // we want `Fw32 == FwAny` and `FwAny == Fw64`, by transitivity we must have
@ -110,7 +110,7 @@ impl Hash for Constant {
c.hash(state); c.hash(state);
}, },
Constant::Int(i) => { Constant::Int(i) => {
i.to_u64_unchecked().hash(state); i.to_u128_unchecked().hash(state);
i.is_negative().hash(state); i.is_negative().hash(state);
}, },
Constant::Float(ref f, _) => { Constant::Float(ref f, _) => {

View file

@ -3,6 +3,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(collections)] #![feature(collections)]
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![feature(i128_type)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(slice_patterns)] #![feature(slice_patterns)]
#![feature(stmt_expr_attributes)] #![feature(stmt_expr_attributes)]

View file

@ -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. /// 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 // FIXME: use constant folding
if let ExprLit(ref spanned) = expr.node { if let ExprLit(ref spanned) = expr.node {
if let LitKind::Int(v, _) = spanned.node { if let LitKind::Int(v, _) = spanned.node {