diff options
| author | Philipp Hansch <dev@phansch.net> | 2018-10-03 13:24:44 +0200 |
|---|---|---|
| committer | Philipp Hansch <dev@phansch.net> | 2018-10-03 13:26:36 +0200 |
| commit | 4d58821eee014c231c7a8d4802c3f221bbe14890 (patch) | |
| tree | be19f2e0fa1efaa07b14c9ada2b33e33b778ce50 | |
| parent | 6622172734a6c456ea85e17b765ad1dbc0e42907 (diff) | |
| download | rust-4d58821eee014c231c7a8d4802c3f221bbe14890.tar.gz rust-4d58821eee014c231c7a8d4802c3f221bbe14890.zip | |
Add examples to `TyKind::FnDef` and `TyKind::FnPtr` docs
| -rw-r--r-- | src/librustc/ty/sty.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 8e4819b68a9..4cf4668443f 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -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`. |
