code review fixes
This commit is contained in:
parent
152f0d347e
commit
a1e59d17e3
2 changed files with 4 additions and 4 deletions
|
@ -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) {
|
if self.tcx.has_attr(def_id, sym::rustc_args_required_const) {
|
||||||
bug!("reifying a fn ptr that requires const arguments");
|
bug!("reifying a fn ptr that requires const arguments");
|
||||||
}
|
}
|
||||||
let instance: InterpResult<'tcx, _> = ty::Instance::resolve(
|
let instance = ty::Instance::resolve(
|
||||||
*self.tcx,
|
*self.tcx,
|
||||||
self.param_env,
|
self.param_env,
|
||||||
def_id,
|
def_id,
|
||||||
substs,
|
substs,
|
||||||
).ok_or_else(|| err_inval!(TooGeneric).into());
|
).ok_or_else(|| err_inval!(TooGeneric))?;
|
||||||
let fn_ptr = self.memory.create_fn_alloc(FnVal::Instance(instance?));
|
let fn_ptr = self.memory.create_fn_alloc(FnVal::Instance(instance));
|
||||||
self.write_scalar(Scalar::Ptr(fn_ptr.into()), dest)?;
|
self.write_scalar(Scalar::Ptr(fn_ptr.into()), dest)?;
|
||||||
}
|
}
|
||||||
_ => bug!("reify fn pointer on {:?}", src.layout.ty),
|
_ => bug!("reify fn pointer on {:?}", src.layout.ty),
|
||||||
|
|
|
@ -363,7 +363,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
|
||||||
// the "real" alignment.
|
// the "real" alignment.
|
||||||
throw_unsup!(AlignmentCheckFailed {
|
throw_unsup!(AlignmentCheckFailed {
|
||||||
has: alloc_align,
|
has: alloc_align,
|
||||||
required: align
|
required: align,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
check_offset_align(ptr.offset.bytes(), align)?;
|
check_offset_align(ptr.offset.bytes(), align)?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue