Split TyBareFn into TyFnDef and TyFnPtr.

There's a lot of stuff wrong with the representation of these types:
TyFnDef doesn't actually uniquely identify a function, TyFnPtr is used to
represent method calls, TyFnDef in the sub-expression of a cast isn't
correctly reified, and probably some other stuff I haven't discovered yet.
Splitting them seems like the right first step, though.
This commit is contained in:
Eli Friedman 2015-06-13 13:15:03 -07:00 committed by Eduard Burtescu
parent 4b868411af
commit b423a0f9ef
73 changed files with 406 additions and 324 deletions

View file

@ -261,16 +261,15 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
pub fn t_fn(&self, input_tys: &[Ty<'tcx>], output_ty: Ty<'tcx>) -> Ty<'tcx> {
let input_args = input_tys.iter().cloned().collect();
self.infcx.tcx.mk_fn(None,
self.infcx.tcx.mk_bare_fn(ty::BareFnTy {
unsafety: hir::Unsafety::Normal,
abi: Abi::Rust,
sig: ty::Binder(ty::FnSig {
inputs: input_args,
output: ty::FnConverging(output_ty),
variadic: false,
}),
}))
self.infcx.tcx.mk_fn_ptr(ty::BareFnTy {
unsafety: hir::Unsafety::Normal,
abi: Abi::Rust,
sig: ty::Binder(ty::FnSig {
inputs: input_args,
output: ty::FnConverging(output_ty),
variadic: false,
}),
})
}
pub fn t_nil(&self) -> Ty<'tcx> {