Skip to content

Commit 4d58821

Browse files
committed
Add examples to TyKind::FnDef and TyKind::FnPtr docs
1 parent 6622172 commit 4d58821

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/librustc/ty/sty.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,26 @@ pub enum TyKind<'tcx> {
127127

128128
/// The anonymous type of a function declaration/definition. Each
129129
/// function has a unique type.
130+
///
131+
/// For example the type of `a` here:
132+
///
133+
/// ```rust
134+
/// fn foo() -> i32 { 1 }
135+
///
136+
/// fn hello() {
137+
/// let a = foo;
138+
/// }
139+
/// ```
130140
FnDef(DefId, &'tcx Substs<'tcx>),
131141

132142
/// A pointer to a function. Written as `fn() -> i32`.
143+
///
144+
/// For example the type of `a` here:
145+
///
146+
/// ```rust
147+
/// fn foo() -> i32 { 1 }
148+
/// let a: fn() -> i32 = foo;
149+
/// ```
133150
FnPtr(PolyFnSig<'tcx>),
134151

135152
/// A trait, defined with `trait`.

0 commit comments

Comments
 (0)