Skip to content

Commit bf5ec79

Browse files
committed
miri: import ty::Ty directly.
1 parent 42a534c commit bf5ec79

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

src/librustc/mir/interpret/cast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use ty::{self, Ty};
1+
use ty::Ty;
22
use syntax::ast::{FloatTy, IntTy, UintTy};
33

44
use rustc_const_math::ConstFloat;
@@ -37,7 +37,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
3737
}
3838
}
3939

40-
fn cast_from_signed_int(&self, val: i128, ty: ty::Ty<'tcx>) -> EvalResult<'tcx, PrimVal> {
40+
fn cast_from_signed_int(&self, val: i128, ty: Ty<'tcx>) -> EvalResult<'tcx, PrimVal> {
4141
self.cast_from_int(val as u128, ty, val < 0)
4242
}
4343

@@ -71,7 +71,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
7171
fn cast_from_int(
7272
&self,
7373
v: u128,
74-
ty: ty::Ty<'tcx>,
74+
ty: Ty<'tcx>,
7575
negative: bool,
7676
) -> EvalResult<'tcx, PrimVal> {
7777
trace!("cast_from_int: {}, {}, {}", v, ty, negative);

src/librustc/mir/interpret/const_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ impl<'tcx> super::Machine<'tcx> for CompileTimeFunctionEvaluator {
274274

275275
fn box_alloc<'a>(
276276
_ecx: &mut EvalContext<'a, 'tcx, Self>,
277-
_ty: ty::Ty<'tcx>,
277+
_ty: Ty<'tcx>,
278278
_dest: Place,
279279
) -> EvalResult<'tcx> {
280280
Err(

src/librustc/mir/interpret/eval_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
346346
/// the value has to be a fat pointer, and we only care about the "extra" data in it.
347347
pub fn size_and_align_of_dst(
348348
&mut self,
349-
ty: ty::Ty<'tcx>,
349+
ty: Ty<'tcx>,
350350
value: Value,
351351
) -> EvalResult<'tcx, (Size, Align)> {
352352
let layout = self.layout_of(ty)?;

src/librustc/mir/interpret/machine.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
55
use super::{EvalResult, EvalContext, Place, PrimVal, ValTy};
66

7-
use {mir, ty};
7+
use mir;
8+
use ty::{self, Ty};
89
use syntax::codemap::Span;
910
use syntax::ast::Mutability;
1011

@@ -60,9 +61,9 @@ pub trait Machine<'tcx>: Sized {
6061
ecx: &EvalContext<'a, 'tcx, Self>,
6162
bin_op: mir::BinOp,
6263
left: PrimVal,
63-
left_ty: ty::Ty<'tcx>,
64+
left_ty: Ty<'tcx>,
6465
right: PrimVal,
65-
right_ty: ty::Ty<'tcx>,
66+
right_ty: Ty<'tcx>,
6667
) -> EvalResult<'tcx, Option<(PrimVal, bool)>>;
6768

6869
/// Called when trying to mark machine defined `MemoryKinds` as static
@@ -73,7 +74,7 @@ pub trait Machine<'tcx>: Sized {
7374
/// Returns a pointer to the allocated memory
7475
fn box_alloc<'a>(
7576
ecx: &mut EvalContext<'a, 'tcx, Self>,
76-
ty: ty::Ty<'tcx>,
77+
ty: Ty<'tcx>,
7778
dest: Place,
7879
) -> EvalResult<'tcx>;
7980

src/librustc/mir/interpret/terminator/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use mir;
2-
use ty::{self, TypeVariants};
2+
use ty::{self, Ty};
33
use ty::layout::LayoutOf;
44
use syntax::codemap::Span;
55
use syntax::abi::Abi;
@@ -177,16 +177,16 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
177177
sig: ty::FnSig<'tcx>,
178178
real_sig: ty::FnSig<'tcx>,
179179
) -> EvalResult<'tcx, bool> {
180-
fn check_ty_compat<'tcx>(ty: ty::Ty<'tcx>, real_ty: ty::Ty<'tcx>) -> bool {
180+
fn check_ty_compat<'tcx>(ty: Ty<'tcx>, real_ty: Ty<'tcx>) -> bool {
181181
if ty == real_ty {
182182
return true;
183183
} // This is actually a fast pointer comparison
184184
return match (&ty.sty, &real_ty.sty) {
185185
// Permit changing the pointer type of raw pointers and references as well as
186186
// mutability of raw pointers.
187187
// TODO: Should not be allowed when fat pointers are involved.
188-
(&TypeVariants::TyRawPtr(_), &TypeVariants::TyRawPtr(_)) => true,
189-
(&TypeVariants::TyRef(_, _), &TypeVariants::TyRef(_, _)) => {
188+
(&ty::TyRawPtr(_), &ty::TyRawPtr(_)) => true,
189+
(&ty::TyRef(_, _), &ty::TyRef(_, _)) => {
190190
ty.is_mutable_pointer() == real_ty.is_mutable_pointer()
191191
}
192192
// rule out everything else
@@ -220,7 +220,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
220220
// Second argument must be a tuple matching the argument list of sig
221221
let snd_ty = real_sig.inputs_and_output[1];
222222
match snd_ty.sty {
223-
TypeVariants::TyTuple(tys, _) if sig.inputs().len() == tys.len() =>
223+
ty::TyTuple(tys, _) if sig.inputs().len() == tys.len() =>
224224
if sig.inputs().iter().zip(tys).all(|(ty, real_ty)| check_ty_compat(ty, real_ty)) {
225225
return Ok(true)
226226
},

src/librustc/mir/interpret/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
337337
base: Place,
338338
mut layout: ty::layout::TyLayout<'tcx>,
339339
i: usize,
340-
) -> EvalResult<'tcx, ty::Ty<'tcx>> {
340+
) -> EvalResult<'tcx, Ty<'tcx>> {
341341
match base {
342342
Place::Ptr { extra: PlaceExtra::DowncastVariant(variant_index), .. } => {
343343
layout = layout.for_variant(&self, variant_index);

0 commit comments

Comments
 (0)