1
Fork 0

code review fixes

This commit is contained in:
Saleem Jaffer 2019-07-31 16:38:39 +05:30
parent 152f0d347e
commit a1e59d17e3
2 changed files with 4 additions and 4 deletions

View file

@ -80,13 +80,13 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
if self.tcx.has_attr(def_id, sym::rustc_args_required_const) {
bug!("reifying a fn ptr that requires const arguments");
}
let instance: InterpResult<'tcx, _> = ty::Instance::resolve(
let instance = ty::Instance::resolve(
*self.tcx,
self.param_env,
def_id,
substs,
).ok_or_else(|| err_inval!(TooGeneric).into());
let fn_ptr = self.memory.create_fn_alloc(FnVal::Instance(instance?));
).ok_or_else(|| err_inval!(TooGeneric))?;
let fn_ptr = self.memory.create_fn_alloc(FnVal::Instance(instance));
self.write_scalar(Scalar::Ptr(fn_ptr.into()), dest)?;
}
_ => bug!("reify fn pointer on {:?}", src.layout.ty),

View file

@ -363,7 +363,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
// the "real" alignment.
throw_unsup!(AlignmentCheckFailed {
has: alloc_align,
required: align
required: align,
})
}
check_offset_align(ptr.offset.bytes(), align)?;