From 9438f4f263e6fa8a53f766069e3522ca12b46ce7 Mon Sep 17 00:00:00 2001 From: mcarton Date: Thu, 31 Mar 2016 17:05:43 +0200 Subject: [PATCH] Rustup to 1.9.0-nightly (30a3849f2 2016-03-30) --- src/array_indexing.rs | 7 ++++--- src/bit_mask.rs | 3 +-- src/consts.rs | 4 ++-- src/enum_clike.rs | 5 +++-- src/identity_op.rs | 2 +- src/lib.rs | 1 + src/loops.rs | 5 +++-- src/matches.rs | 7 ++++--- src/methods.rs | 5 +++-- src/misc.rs | 8 ++++---- src/regex.rs | 5 +++-- src/types.rs | 11 ++++++----- tests/consts.rs | 21 +++++++++------------ 13 files changed, 44 insertions(+), 40 deletions(-) diff --git a/src/array_indexing.rs b/src/array_indexing.rs index 344a8b8c3..e5f54c128 100644 --- a/src/array_indexing.rs +++ b/src/array_indexing.rs @@ -1,9 +1,10 @@ use rustc::lint::*; -use rustc::middle::const_eval::EvalHint::ExprTypeChecked; -use rustc::middle::const_eval::{eval_const_expr_partial, ConstVal}; +use rustc::middle::const_val::ConstVal; use rustc::ty::TyArray; +use rustc_const_eval::EvalHint::ExprTypeChecked; +use rustc_const_eval::eval_const_expr_partial; +use rustc_const_math::ConstInt; use rustc_front::hir::*; -use rustc_const_eval::ConstInt; use syntax::ast::RangeLimits; use utils; diff --git a/src/bit_mask.rs b/src/bit_mask.rs index 28fc31150..cbe601ba1 100644 --- a/src/bit_mask.rs +++ b/src/bit_mask.rs @@ -1,11 +1,10 @@ use rustc::lint::*; -use rustc::middle::const_eval::lookup_const_by_id; use rustc::middle::def::{Def, PathResolution}; +use rustc_const_eval::lookup_const_by_id; use rustc_front::hir::*; use rustc_front::util::is_comparison_binop; use syntax::ast::LitKind; use syntax::codemap::Span; - use utils::span_lint; /// **What it does:** This lint checks for incompatible bit masks in comparisons. diff --git a/src/consts.rs b/src/consts.rs index 97a99dda4..73f2bc465 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -1,10 +1,10 @@ #![allow(cast_possible_truncation)] use rustc::lint::LateContext; -use rustc::middle::const_eval::lookup_const_by_id; use rustc::middle::def::{Def, PathResolution}; +use rustc_const_eval::lookup_const_by_id; +use rustc_const_math::{ConstInt, ConstUsize, ConstIsize}; use rustc_front::hir::*; -use rustc_const_eval::{ConstInt, ConstUsize, ConstIsize}; use std::cmp::Ordering::{self, Equal}; use std::cmp::PartialOrd; use std::hash::{Hash, Hasher}; diff --git a/src/enum_clike.rs b/src/enum_clike.rs index 85fa418f2..0e2a7a530 100644 --- a/src/enum_clike.rs +++ b/src/enum_clike.rs @@ -1,9 +1,10 @@ //! lint on C-like enums that are `repr(isize/usize)` and have values that don't fit into an `i32` use rustc::lint::*; -use syntax::attr::*; +use rustc::middle::const_val::ConstVal; +use rustc_const_math::*; use rustc_front::hir::*; -use rustc::middle::const_eval::{ConstVal, EvalHint, eval_const_expr_partial}; +use syntax::attr::*; use utils::span_lint; /// **What it does:** Lints on C-like enums that are `repr(isize/usize)` and have values that don't fit into an `i32`. diff --git a/src/identity_op.rs b/src/identity_op.rs index 9ade801ab..c25047b87 100644 --- a/src/identity_op.rs +++ b/src/identity_op.rs @@ -3,7 +3,7 @@ use rustc::lint::*; use rustc_front::hir::*; use syntax::codemap::Span; use utils::{span_lint, snippet, in_macro}; -use rustc_const_eval::ConstInt; +use rustc_const_math::ConstInt; /// **What it does:** This lint checks for identity operations, e.g. `x + 0`. /// diff --git a/src/lib.rs b/src/lib.rs index 2d12532fc..759704495 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,6 +42,7 @@ extern crate quine_mc_cluskey; extern crate rustc_plugin; extern crate rustc_const_eval; +extern crate rustc_const_math; use rustc_plugin::Registry; pub mod consts; diff --git a/src/loops.rs b/src/loops.rs index 10a8a76d7..20d0fc026 100644 --- a/src/loops.rs +++ b/src/loops.rs @@ -1,11 +1,12 @@ use reexport::*; use rustc::front::map::Node::NodeBlock; use rustc::lint::*; -use rustc::middle::const_eval::EvalHint::ExprTypeChecked; -use rustc::middle::const_eval::{ConstVal, eval_const_expr_partial}; +use rustc::middle::const_val::ConstVal; use rustc::middle::def::Def; use rustc::middle::region::CodeExtent; use rustc::ty; +use rustc_const_eval::EvalHint::ExprTypeChecked; +use rustc_const_eval::eval_const_expr_partial; use rustc_front::hir::*; use rustc_front::intravisit::{Visitor, walk_expr, walk_block, walk_decl}; use std::borrow::Cow; diff --git a/src/matches.rs b/src/matches.rs index 7bffd445f..40013209e 100644 --- a/src/matches.rs +++ b/src/matches.rs @@ -1,9 +1,10 @@ use rustc::lint::*; -use rustc::middle::const_eval::EvalHint::ExprTypeChecked; -use rustc::middle::const_eval::{eval_const_expr_partial, ConstVal}; +use rustc::middle::const_val::ConstVal; use rustc::ty; +use rustc_const_eval::EvalHint::ExprTypeChecked; +use rustc_const_eval::eval_const_expr_partial; +use rustc_const_math::ConstInt; use rustc_front::hir::*; -use rustc_const_eval::ConstInt; use std::cmp::Ordering; use syntax::ast::LitKind; use syntax::codemap::Span; diff --git a/src/methods.rs b/src/methods.rs index b8bbc0e90..3ba6bfc9b 100644 --- a/src/methods.rs +++ b/src/methods.rs @@ -1,9 +1,10 @@ use rustc::lint::*; -use rustc::middle::const_eval::EvalHint::ExprTypeChecked; -use rustc::middle::const_eval::{ConstVal, eval_const_expr_partial}; +use rustc::middle::const_val::ConstVal; use rustc::middle::cstore::CrateStore; use rustc::ty::subst::{Subst, TypeSpace}; use rustc::ty; +use rustc_const_eval::EvalHint::ExprTypeChecked; +use rustc_const_eval::eval_const_expr_partial; use rustc_front::hir::*; use std::borrow::Cow; use std::fmt; diff --git a/src/misc.rs b/src/misc.rs index 5a787ba6d..a6cfec276 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -1,9 +1,9 @@ use reexport::*; use rustc::lint::*; -use rustc::middle::const_eval::ConstVal::Float; -use rustc::middle::const_eval::EvalHint::ExprTypeChecked; -use rustc::middle::const_eval::eval_const_expr_partial; +use rustc::middle::const_val::ConstVal; use rustc::ty; +use rustc_const_eval::EvalHint::ExprTypeChecked; +use rustc_const_eval::eval_const_expr_partial; use rustc_front::hir::*; use rustc_front::intravisit::FnKind; use rustc_front::util::{is_comparison_binop, binop_to_string}; @@ -180,7 +180,7 @@ impl LateLintPass for FloatCmp { fn is_allowed(cx: &LateContext, expr: &Expr) -> bool { let res = eval_const_expr_partial(cx.tcx, expr, ExprTypeChecked, None); - if let Ok(Float(val)) = res { + if let Ok(ConstVal::Float(val)) = res { val == 0.0 || val == ::std::f64::INFINITY || val == ::std::f64::NEG_INFINITY } else { false diff --git a/src/regex.rs b/src/regex.rs index e8a71a2cb..46ee7776d 100644 --- a/src/regex.rs +++ b/src/regex.rs @@ -1,7 +1,8 @@ use regex_syntax; use rustc::lint::*; -use rustc::middle::const_eval::EvalHint::ExprTypeChecked; -use rustc::middle::const_eval::{eval_const_expr_partial, ConstVal}; +use rustc::middle::const_val::ConstVal; +use rustc_const_eval::EvalHint::ExprTypeChecked; +use rustc_const_eval::eval_const_expr_partial; use rustc_front::hir::*; use std::collections::HashSet; use std::error::Error; diff --git a/src/types.rs b/src/types.rs index c2fc242ec..8e9ac1217 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,6 +1,6 @@ use reexport::*; use rustc::lint::*; -use rustc::middle::{const_eval, def}; +use rustc::middle::def; use rustc::ty; use rustc_front::hir::*; use rustc_front::intravisit::{FnKind, Visitor, walk_ty}; @@ -683,10 +683,11 @@ fn detect_absurd_comparison<'a>(cx: &LateContext, op: BinOp_, lhs: &'a Expr, rhs } fn detect_extreme_expr<'a>(cx: &LateContext, expr: &'a Expr) -> Option> { - use rustc::middle::const_eval::EvalHint::ExprTypeChecked; - use types::ExtremeType::*; - use rustc::middle::const_eval::ConstVal::*; + use rustc::middle::const_val::ConstVal::*; + use rustc_const_math::*; + use rustc_const_eval::EvalHint::ExprTypeChecked; use rustc_const_eval::*; + use types::ExtremeType::*; let ty = &cx.tcx.expr_ty(expr).sty; @@ -695,7 +696,7 @@ fn detect_extreme_expr<'a>(cx: &LateContext, expr: &'a Expr) -> Option return None, }; - let cv = match const_eval::eval_const_expr_partial(cx.tcx, expr, ExprTypeChecked, None) { + let cv = match eval_const_expr_partial(cx.tcx, expr, ExprTypeChecked, None) { Ok(val) => val, Err(_) => return None, }; diff --git a/tests/consts.rs b/tests/consts.rs index 3a774f674..b7b2f6a3f 100644 --- a/tests/consts.rs +++ b/tests/consts.rs @@ -2,22 +2,19 @@ #![feature(rustc_private)] extern crate clippy; -extern crate syntax; extern crate rustc; -extern crate rustc_front; extern crate rustc_const_eval; - -use rustc_front::hir::*; -use rustc_const_eval::ConstInt; -use syntax::parse::token::InternedString; -use syntax::ptr::P; -use syntax::codemap::{Spanned, COMMAND_LINE_SP}; - -use syntax::ast::LitKind; -use syntax::ast::LitIntType; -use syntax::ast::StrStyle; +extern crate rustc_const_math; +extern crate rustc_front; +extern crate syntax; use clippy::consts::{constant_simple, Constant, FloatWidth}; +use rustc_const_math::ConstInt; +use rustc_front::hir::*; +use syntax::ast::{LitIntType, LitKind, StrStyle}; +use syntax::codemap::{Spanned, COMMAND_LINE_SP}; +use syntax::parse::token::InternedString; +use syntax::ptr::P; fn spanned(t: T) -> Spanned { Spanned{ node: t, span: COMMAND_LINE_SP }