cleanup
This commit is contained in:
parent
dd1cd672e8
commit
b1c2b9891d
4 changed files with 5 additions and 9 deletions
|
@ -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");
|
||||
|
|
|
@ -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)?
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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| {
|
||||
(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue