Merge pull request #226 from dwrensha/rustup
update for upstream changes to TyFnDef
This commit is contained in:
commit
4a560834b9
@ -771,7 +771,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||
}
|
||||
|
||||
ReifyFnPointer => match self.operand_ty(operand).sty {
|
||||
ty::TyFnDef(def_id, substs, _) => {
|
||||
ty::TyFnDef(def_id, substs) => {
|
||||
let instance = resolve(self.tcx, def_id, substs);
|
||||
let fn_ptr = self.memory.create_fn_alloc(instance);
|
||||
self.write_value(Value::ByVal(PrimVal::Ptr(fn_ptr)), dest, dest_ty)?;
|
||||
@ -1686,7 +1686,7 @@ pub fn eval_main<'a, 'tcx: 'a>(
|
||||
let main_ptr = ecx.memory.create_fn_alloc(main_instance);
|
||||
let dest = ecx.eval_lvalue(&mir::Lvalue::Local(args.next().unwrap()))?;
|
||||
let main_ty = main_instance.def.def_ty(ecx.tcx);
|
||||
let main_ptr_ty = ecx.tcx.mk_fn_ptr(main_ty.fn_sig());
|
||||
let main_ptr_ty = ecx.tcx.mk_fn_ptr(main_ty.fn_sig(ecx.tcx));
|
||||
ecx.write_value(Value::ByVal(PrimVal::Ptr(main_ptr)), dest, main_ptr_ty)?;
|
||||
|
||||
// Second argument (argc): 0
|
||||
@ -1830,7 +1830,7 @@ fn fn_once_adapter_instance<'a, 'tcx>(
|
||||
let self_ty = tcx.mk_closure_from_closure_substs(
|
||||
closure_did, substs);
|
||||
|
||||
let sig = tcx.closure_type(closure_did).subst(tcx, substs.substs);
|
||||
let sig = tcx.fn_sig(closure_did).subst(tcx, substs.substs);
|
||||
let sig = tcx.erase_late_bound_regions_and_normalize(&sig);
|
||||
assert_eq!(sig.inputs().len(), 1);
|
||||
let substs = tcx.mk_substs([
|
||||
@ -1891,9 +1891,11 @@ pub fn resolve<'a, 'tcx>(
|
||||
} else {
|
||||
let item_type = def_ty(tcx, def_id, substs);
|
||||
let def = match item_type.sty {
|
||||
ty::TyFnDef(_, _, f) if
|
||||
f.abi() == Abi::RustIntrinsic ||
|
||||
f.abi() == Abi::PlatformIntrinsic =>
|
||||
ty::TyFnDef(..) if {
|
||||
let f = item_type.fn_sig(tcx);
|
||||
f.abi() == Abi::RustIntrinsic ||
|
||||
f.abi() == Abi::PlatformIntrinsic
|
||||
} =>
|
||||
{
|
||||
debug!(" => intrinsic");
|
||||
ty::InstanceDef::Intrinsic(def_id)
|
||||
|
@ -72,9 +72,11 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||
let instance_ty = instance.def.def_ty(self.tcx);
|
||||
let instance_ty = self.monomorphize(instance_ty, instance.substs);
|
||||
match instance_ty.sty {
|
||||
ty::TyFnDef(_, _, real_sig) => {
|
||||
ty::TyFnDef(..) => {
|
||||
let real_sig = instance_ty.fn_sig(self.tcx);
|
||||
let sig = self.erase_lifetimes(&sig);
|
||||
let real_sig = self.erase_lifetimes(&real_sig);
|
||||
let real_sig = self.tcx.normalize_associated_type(&real_sig);
|
||||
if !self.check_sig_compat(sig, real_sig)? {
|
||||
return Err(EvalError::FunctionPointerTyMismatch(real_sig, sig));
|
||||
}
|
||||
@ -83,7 +85,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||
}
|
||||
(instance, sig)
|
||||
},
|
||||
ty::TyFnDef(def_id, substs, sig) => (::eval_context::resolve(self.tcx, def_id, substs), sig),
|
||||
ty::TyFnDef(def_id, substs) => (::eval_context::resolve(self.tcx, def_id, substs), func_ty.fn_sig(self.tcx)),
|
||||
_ => {
|
||||
let msg = format!("can't handle callee of type {:?}", func_ty);
|
||||
return Err(EvalError::Unimplemented(msg));
|
||||
|
Loading…
x
Reference in New Issue
Block a user