about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-08-07 07:05:53 +0000
committerbors <bors@rust-lang.org>2019-08-07 07:05:53 +0000
commitb041511b5fcd386c4ae74a30b60a5081f8717fbe (patch)
tree62be248791315b9f28de9a057088f6d8283659b9
parentea26a95fc9aa4fc00aa590d68b665339d79a6884 (diff)
parente4f8cd967235cd4d12e484901cb1174c58161a33 (diff)
downloadrust-b041511b5fcd386c4ae74a30b60a5081f8717fbe.tar.gz
rust-b041511b5fcd386c4ae74a30b60a5081f8717fbe.zip
Auto merge of #4340 - lzutao:rustup, r=oli-obk
Rustup https://github.com/rust-lang/rust/pull/59369

Unblock https://github.com/rust-lang/rust/pull/63280

changelog: none
-rw-r--r--clippy_lints/src/consts.rs2
-rw-r--r--clippy_lints/src/indexing_slicing.rs2
-rw-r--r--clippy_lints/src/loops.rs6
-rw-r--r--clippy_lints/src/methods/mod.rs2
4 files changed, 6 insertions, 6 deletions
diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs
index 9d1cc110e5d..fe57c300a34 100644
--- a/clippy_lints/src/consts.rs
+++ b/clippy_lints/src/consts.rs
@@ -230,7 +230,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
             ExprKind::Tup(ref tup) => self.multi(tup).map(Constant::Tuple),
             ExprKind::Repeat(ref value, _) => {
                 let n = match self.tables.expr_ty(e).sty {
-                    ty::Array(_, n) => n.assert_usize(self.lcx.tcx).expect("array length"),
+                    ty::Array(_, n) => n.eval_usize(self.lcx.tcx, self.lcx.param_env),
                     _ => span_bug!(e.span, "typeck error"),
                 };
                 self.expr(value).map(|v| Constant::Repeat(Box::new(v), n))
diff --git a/clippy_lints/src/indexing_slicing.rs b/clippy_lints/src/indexing_slicing.rs
index 06e5458c185..02dafbe2e39 100644
--- a/clippy_lints/src/indexing_slicing.rs
+++ b/clippy_lints/src/indexing_slicing.rs
@@ -94,7 +94,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IndexingSlicing {
             if let Some(range) = higher::range(cx, index) {
                 // Ranged indexes, i.e., &x[n..m], &x[n..], &x[..n] and &x[..]
                 if let ty::Array(_, s) = ty.sty {
-                    let size: u128 = s.assert_usize(cx.tcx).unwrap().into();
+                    let size: u128 = s.eval_usize(cx.tcx, cx.param_env).into();
 
                     let const_range = to_const_range(cx, range, size);
 
diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs
index 7a5ac47b6e7..1f9120a5383 100644
--- a/clippy_lints/src/loops.rs
+++ b/clippy_lints/src/loops.rs
@@ -1253,7 +1253,7 @@ fn is_end_eq_array_len<'tcx>(
         if let ExprKind::Lit(ref lit) = end.node;
         if let ast::LitKind::Int(end_int, _) = lit.node;
         if let ty::Array(_, arr_len_const) = indexed_ty.sty;
-        if let Some(arr_len) = arr_len_const.assert_usize(cx.tcx);
+        if let Some(arr_len) = arr_len_const.try_eval_usize(cx.tcx, cx.param_env);
         then {
             return match limits {
                 ast::RangeLimits::Closed => end_int + 1 >= arr_len.into(),
@@ -1375,7 +1375,7 @@ fn check_for_loop_arg(cx: &LateContext<'_, '_>, pat: &Pat, arg: &Expr, expr: &Ex
                     match cx.tables.expr_ty(&args[0]).sty {
                         // If the length is greater than 32 no traits are implemented for array and
                         // therefore we cannot use `&`.
-                        ty::Array(_, size) if size.assert_usize(cx.tcx).expect("array size") > 32 => (),
+                        ty::Array(_, size) if size.eval_usize(cx.tcx, cx.param_env) > 32 => {},
                         _ => lint_iter_method(cx, args, arg, method_name),
                     };
                 } else {
@@ -1988,7 +1988,7 @@ fn is_ref_iterable_type(cx: &LateContext<'_, '_>, e: &Expr) -> bool {
 fn is_iterable_array<'tcx>(ty: Ty<'tcx>, cx: &LateContext<'_, 'tcx>) -> bool {
     // IntoIterator is currently only implemented for array sizes <= 32 in rustc
     match ty.sty {
-        ty::Array(_, n) => (0..=32).contains(&n.assert_usize(cx.tcx).expect("array length")),
+        ty::Array(_, n) => (0..=32).contains(&n.eval_usize(cx.tcx, cx.param_env)),
         _ => false,
     }
 }
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs
index 5bb5ebc83a4..f40171aeed3 100644
--- a/clippy_lints/src/methods/mod.rs
+++ b/clippy_lints/src/methods/mod.rs
@@ -1825,7 +1825,7 @@ fn derefs_to_slice<'a, 'tcx>(
             ty::Slice(_) => true,
             ty::Adt(def, _) if def.is_box() => may_slice(cx, ty.boxed_ty()),
             ty::Adt(..) => match_type(cx, ty, &paths::VEC),
-            ty::Array(_, size) => size.assert_usize(cx.tcx).expect("array length") < 32,
+            ty::Array(_, size) => size.eval_usize(cx.tcx, cx.param_env) < 32,
             ty::Ref(_, inner, _) => may_slice(cx, inner),
             _ => false,
         }