diff options
| author | DPC <dylan.dpc@gmail.com> | 2020-08-25 03:00:27 +0200 |
|---|---|---|
| committer | DPC <dylan.dpc@gmail.com> | 2020-08-25 03:00:27 +0200 |
| commit | b1c2b9891dea834f28e921ce40107ea8bcb4cbc6 (patch) | |
| tree | 4fc12a4a3bb10907d11fa3ff72cb6cd4d1e3dd43 /src | |
| parent | dd1cd672e8138820a17bcec4e67f99ff394566b1 (diff) | |
| download | rust-b1c2b9891dea834f28e921ce40107ea8bcb4cbc6.tar.gz rust-b1c2b9891dea834f28e921ce40107ea8bcb4cbc6.zip | |
cleanup
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/borrow_check/type_check/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/place.rs | 6 | ||||
| -rw-r--r-- | src/librustc_mir/util/aggregate.rs | 1 | ||||
| -rw-r--r-- | src/librustc_mir/util/elaborate_drops.rs | 5 |
4 files changed, 5 insertions, 9 deletions
diff --git a/src/librustc_mir/borrow_check/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs index 168a352591d..c1fc029cc47 100644 --- a/src/librustc_mir/borrow_check/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/type_check/mod.rs @@ -649,7 +649,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { PlaceTy::from_ty(match base_ty.kind { ty::Array(inner, _) => { assert!(!from_end, "array subslices should not use from_end"); - tcx.mk_array(inner, (to - from) as u64) + tcx.mk_array(inner, to - from) } ty::Slice(..) => { assert!(from_end, "slice subslices should use from_end"); diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 20fd8e43361..6ba6103b311 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -549,17 +549,17 @@ where ConstantIndex { offset, min_length, from_end } => { let n = base.len(self)?; - if n < u64::from(min_length) { + if n < min_length { // This can only be reached in ConstProp and non-rustc-MIR. throw_ub!(BoundsCheckFailed { len: min_length.into(), index: n }); } let index = if from_end { assert!(0 < offset && offset <= min_length); - n.checked_sub(u64::from(offset)).unwrap() + n.checked_sub(offset).unwrap() } else { assert!(offset < min_length); - u64::from(offset) + offset }; self.mplace_index(base, index)? diff --git a/src/librustc_mir/util/aggregate.rs b/src/librustc_mir/util/aggregate.rs index 3afe8d22943..6a7505291ef 100644 --- a/src/librustc_mir/util/aggregate.rs +++ b/src/librustc_mir/util/aggregate.rs @@ -4,6 +4,7 @@ use rustc_middle::ty::{Ty, TyCtxt}; use rustc_target::abi::VariantIdx; use std::iter::TrustedLen; +use std::convert::TryFrom; /// Expand `lhs = Rvalue::Aggregate(kind, operands)` into assignments to the fields. /// diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 6acbb0ad4db..653dffc22cf 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -10,8 +10,6 @@ use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_target::abi::VariantIdx; use std::fmt; -use std::convert::TryInto; - /// The value of an inserted drop flag. #[derive(Debug, PartialEq, Eq, Copy, Clone)] pub enum DropFlagState { @@ -744,9 +742,6 @@ where let tcx = self.tcx(); if let Some(size) = opt_size { - let size: u64 = size.try_into().unwrap_or_else(|_| { - bug!("move out check isn't implemented for array sizes bigger than u64::MAX"); - }); let fields: Vec<(Place<'tcx>, Option<D::Path>)> = (0..size) .map(|i| { ( |
