From b423a0f9ef488ca4cd9ff620a44566bb441eb21f Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sat, 13 Jun 2015 13:15:03 -0700 Subject: 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. --- src/librustc_metadata/decoder.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/librustc_metadata/decoder.rs') diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index e286e028f33..3ddfa1d2730 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -472,7 +472,7 @@ pub fn get_adt_def<'tcx>(intr: &IdentInterner, variant.name, ctor_ty); let field_tys = match ctor_ty.sty { - ty::TyBareFn(_, &ty::BareFnTy { sig: ty::Binder(ty::FnSig { + ty::TyFnDef(_, &ty::BareFnTy { sig: ty::Binder(ty::FnSig { ref inputs, .. }), ..}) => { // tuple-struct constructors don't have escaping regions @@ -988,7 +988,7 @@ pub fn get_impl_or_trait_item<'tcx>(intr: Rc, let predicates = doc_predicates(item_doc, tcx, cdata, tag_method_ty_generics); let ity = tcx.lookup_item_type(def_id).ty; let fty = match ity.sty { - ty::TyBareFn(_, fty) => fty.clone(), + ty::TyFnDef(_, fty) => fty.clone(), _ => tcx.sess.bug(&format!( "the type {:?} of the method {:?} is not a function?", ity, name)) @@ -1582,7 +1582,8 @@ pub fn is_extern_item(cdata: Cmd, id: DefIndex, tcx: &TyCtxt) -> bool { let ty::TypeScheme { generics, ty } = get_type(cdata, id, tcx); let no_generics = generics.types.is_empty(); match ty.sty { - ty::TyBareFn(_, fn_ty) if fn_ty.abi != Abi::Rust => return no_generics, + ty::TyFnDef(_, fn_ty) | ty::TyFnPtr(fn_ty) + if fn_ty.abi != Abi::Rust => return no_generics, _ => no_generics, } }, -- cgit 1.4.1-3-g733a5