Skip to content

Commit 2e603a2

Browse files
eefriedmaneddyb
authored andcommitted
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.
1 parent 7d338fe commit 2e603a2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clean/inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub fn build_external_trait(cx: &DocContext, tcx: &TyCtxt,
164164
fn build_external_function(cx: &DocContext, tcx: &TyCtxt, did: DefId) -> clean::Function {
165165
let t = tcx.lookup_item_type(did);
166166
let (decl, style, abi) = match t.ty.sty {
167-
ty::TyBareFn(_, ref f) => ((did, &f.sig).clean(cx), f.unsafety, f.abi),
167+
ty::TyFnDef(_, ref f) => ((did, &f.sig).clean(cx), f.unsafety, f.abi),
168168
_ => panic!("bad function"),
169169
};
170170

clean/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,8 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
16631663
mutability: mt.mutbl.clean(cx),
16641664
type_: box mt.ty.clean(cx),
16651665
},
1666-
ty::TyBareFn(_, ref fty) => BareFunction(box BareFunctionDecl {
1666+
ty::TyFnDef(_, ref fty) |
1667+
ty::TyFnPtr(ref fty) => BareFunction(box BareFunctionDecl {
16671668
unsafety: fty.unsafety,
16681669
generics: Generics {
16691670
lifetimes: Vec::new(),

0 commit comments

Comments
 (0)