use crate::build::Builder;
use crate::hair::pattern::compare_const_vals;
use crate::hair::*;
-use rustc::mir::*;
-use rustc::ty::layout::VariantIdx;
-use rustc::ty::util::IntTypeExt;
-use rustc::ty::{self, adjustment::PointerCast, Ty};
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::RangeEnd;
use rustc_index::bit_set::BitSet;
+use rustc_middle::mir::*;
+use rustc_middle::ty::util::IntTypeExt;
+use rustc_middle::ty::{self, adjustment::PointerCast, Ty};
use rustc_span::symbol::sym;
+use rustc_target::abi::VariantIdx;
use std::cmp::Ordering;
);
let discr_ty = adt_def.repr.discr_type().to_ty(tcx);
let discr = self.temp(discr_ty, test.span);
- self.cfg.push_assign(block, source_info, &discr, Rvalue::Discriminant(place));
+ self.cfg.push_assign(block, source_info, discr, Rvalue::Discriminant(place));
assert_eq!(values.len() + 1, targets.len());
self.cfg.terminate(
block,
let actual = self.temp(usize_ty, test.span);
// actual = len(place)
- self.cfg.push_assign(block, source_info, &actual, Rvalue::Len(place));
+ self.cfg.push_assign(block, source_info, actual, Rvalue::Len(place));
// expected = <N>
let expected = self.push_usize(block, source_info, len);
let result = self.temp(bool_ty, source_info.span);
// result = op(left, right)
- self.cfg.push_assign(block, source_info, &result, Rvalue::BinaryOp(op, left, right));
+ self.cfg.push_assign(block, source_info, result, Rvalue::BinaryOp(op, left, right));
// branch based on result
self.cfg.terminate(
place: Place<'tcx>,
mut ty: Ty<'tcx>,
) {
- use rustc::middle::lang_items::EqTraitLangItem;
+ use rustc_hir::lang_items::EqTraitLangItem;
let mut expect = self.literal_operand(source_info.span, value);
let mut val = Operand::Copy(place);
self.cfg.push_assign(
block,
source_info,
- &temp,
+ temp,
Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), val, ty),
);
val = Operand::Move(temp);
self.cfg.push_assign(
block,
source_info,
- &slice,
+ slice,
Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), expect, ty),
);
expect = Operand::Move(slice);
// enough elements.
Some(1)
}
- (Ordering::Equal, &Some(_)) | (Ordering::Greater, &Some(_)) => {
+ (Ordering::Equal | Ordering::Greater, &Some(_)) => {
// This can match both if $actual_len = test_len >= pat_len,
// and if $actual_len > test_len. We can't advance.
None
(&TestKind::Range { .. }, _) => None,
- (&TestKind::Eq { .. }, _) | (&TestKind::Len { .. }, _) => {
+ (&TestKind::Eq { .. } | &TestKind::Len { .. }, _) => {
// These are all binary tests.
//
// FIXME(#29623) we can be more clever here