Skip to content

Commit

Permalink
Add examples to TyKind::FnDef and TyKind::FnPtr docs
Browse files Browse the repository at this point in the history
  • Loading branch information
phansch committed Oct 3, 2018
1 parent 6622172 commit 4d58821
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,26 @@ pub enum TyKind<'tcx> {

/// The anonymous type of a function declaration/definition. Each
/// function has a unique type.
///
/// For example the type of `a` here:
///
/// ```rust
/// fn foo() -> i32 { 1 }
///
/// fn hello() {
/// let a = foo;
/// }
/// ```
FnDef(DefId, &'tcx Substs<'tcx>),

/// A pointer to a function. Written as `fn() -> i32`.
///
/// For example the type of `a` here:
///
/// ```rust
/// fn foo() -> i32 { 1 }
/// let a: fn() -> i32 = foo;
/// ```
FnPtr(PolyFnSig<'tcx>),

/// A trait, defined with `trait`.
Expand Down

0 comments on commit 4d58821

Please sign in to comment.