Skip to content

Commit b1c2b98

Browse files
committed
cleanup
1 parent dd1cd67 commit b1c2b98

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

src/librustc_mir/borrow_check/type_check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
649649
PlaceTy::from_ty(match base_ty.kind {
650650
ty::Array(inner, _) => {
651651
assert!(!from_end, "array subslices should not use from_end");
652-
tcx.mk_array(inner, (to - from) as u64)
652+
tcx.mk_array(inner, to - from)
653653
}
654654
ty::Slice(..) => {
655655
assert!(from_end, "slice subslices should use from_end");

src/librustc_mir/interpret/place.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -549,17 +549,17 @@ where
549549

550550
ConstantIndex { offset, min_length, from_end } => {
551551
let n = base.len(self)?;
552-
if n < u64::from(min_length) {
552+
if n < min_length {
553553
// This can only be reached in ConstProp and non-rustc-MIR.
554554
throw_ub!(BoundsCheckFailed { len: min_length.into(), index: n });
555555
}
556556

557557
let index = if from_end {
558558
assert!(0 < offset && offset <= min_length);
559-
n.checked_sub(u64::from(offset)).unwrap()
559+
n.checked_sub(offset).unwrap()
560560
} else {
561561
assert!(offset < min_length);
562-
u64::from(offset)
562+
offset
563563
};
564564

565565
self.mplace_index(base, index)?

src/librustc_mir/util/aggregate.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use rustc_middle::ty::{Ty, TyCtxt};
44
use rustc_target::abi::VariantIdx;
55

66
use std::iter::TrustedLen;
7+
use std::convert::TryFrom;
78

89
/// Expand `lhs = Rvalue::Aggregate(kind, operands)` into assignments to the fields.
910
///

src/librustc_mir/util/elaborate_drops.rs

-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
1010
use rustc_target::abi::VariantIdx;
1111
use std::fmt;
1212

13-
use std::convert::TryInto;
14-
1513
/// The value of an inserted drop flag.
1614
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
1715
pub enum DropFlagState {
@@ -744,9 +742,6 @@ where
744742
let tcx = self.tcx();
745743

746744
if let Some(size) = opt_size {
747-
let size: u64 = size.try_into().unwrap_or_else(|_| {
748-
bug!("move out check isn't implemented for array sizes bigger than u64::MAX");
749-
});
750745
let fields: Vec<(Place<'tcx>, Option<D::Path>)> = (0..size)
751746
.map(|i| {
752747
(

0 commit comments

Comments
 (0)