Skip to content

Commit 42b6d73

Browse files
committed
Rustup to rustc 1.31.0-nightly (46880f4 2018-10-15)
1 parent 086f356 commit 42b6d73

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

src/constant.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use std::borrow::Cow;
21
use cranelift_module::*;
32
use crate::prelude::*;
43
use crate::rustc::mir::interpret::{
54
read_target_uint, AllocId, AllocType, Allocation, ConstValue, EvalResult, GlobalId, Scalar,
65
};
76
use crate::rustc::ty::Const;
87
use crate::rustc_mir::interpret::{EvalContext, Machine, Memory, MemoryKind, OpTy, PlaceTy};
8+
use std::borrow::Cow;
99

1010
#[derive(Default)]
1111
pub struct ConstantCx {
@@ -283,7 +283,10 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for TransPlaceInterpreter {
283283
type MemoryMap = FxHashMap<AllocId, (MemoryKind<()>, Allocation<()>)>;
284284
type PointerTag = ();
285285
const STATIC_KIND: Option<()> = None;
286-
const ENFORCE_VALIDITY: bool = true;
286+
287+
fn enforce_validity(_: &EvalContext<'a, 'mir, 'tcx, Self>) -> bool {
288+
false
289+
}
287290

288291
fn before_terminator(_: &mut EvalContext<'a, 'mir, 'tcx, Self>) -> EvalResult<'tcx> {
289292
panic!();

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ use crate::prelude::*;
105105

106106
pub struct Caches<'tcx> {
107107
pub context: Context,
108-
pub vtables: HashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), DataId>,
108+
pub vtables: HashMap<(Ty<'tcx>, ty::PolyExistentialTraitRef<'tcx>), DataId>,
109109
}
110110

111111
impl<'tcx> Caches<'tcx> {

src/vtable.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn get_ptr_and_method_ref<'a, 'tcx: 'a>(
5353
pub fn get_vtable<'a, 'tcx: 'a>(
5454
fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
5555
ty: Ty<'tcx>,
56-
trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>,
56+
trait_ref: ty::PolyExistentialTraitRef<'tcx>,
5757
) -> Value {
5858
let data_id = if let Some(data_id) = fx.caches.vtables.get(&(ty, trait_ref)) {
5959
*data_id
@@ -72,7 +72,7 @@ pub fn get_vtable<'a, 'tcx: 'a>(
7272
fn build_vtable<'a, 'tcx: 'a>(
7373
fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
7474
ty: Ty<'tcx>,
75-
trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>,
75+
trait_ref: ty::PolyExistentialTraitRef<'tcx>,
7676
) -> DataId {
7777
let tcx = fx.tcx;
7878
let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
@@ -87,18 +87,16 @@ fn build_vtable<'a, 'tcx: 'a>(
8787

8888
let mut components: Vec<_> = vec![Some(drop_in_place_fn), None, None];
8989

90-
if let Some(trait_ref) = trait_ref {
91-
let trait_ref = trait_ref.with_self_ty(tcx, ty);
92-
let methods = tcx.vtable_methods(trait_ref);
93-
let methods = methods.iter().cloned().map(|opt_mth| {
94-
opt_mth.map_or(None, |(def_id, substs)| {
95-
Some(fx.get_function_id(
96-
Instance::resolve(tcx, ParamEnv::reveal_all(), def_id, substs).unwrap(),
97-
))
98-
})
99-
});
100-
components.extend(methods);
101-
}
90+
let trait_ref = trait_ref.with_self_ty(tcx, ty);
91+
let methods = tcx.vtable_methods(trait_ref);
92+
let methods = methods.iter().cloned().map(|opt_mth| {
93+
opt_mth.map_or(None, |(def_id, substs)| {
94+
Some(fx.get_function_id(
95+
Instance::resolve(tcx, ParamEnv::reveal_all(), def_id, substs).unwrap(),
96+
))
97+
})
98+
});
99+
components.extend(methods);
102100

103101
let mut data_ctx = DataContext::new();
104102
let mut data = ::std::iter::repeat(0u8)

0 commit comments

Comments
 (0)