Skip to content

Commit 769b383

Browse files
committed
Further improve docs for FnDef and FnPtr
1 parent 4d58821 commit 769b383

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/librustc/ty/sty.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,26 +126,24 @@ pub enum TyKind<'tcx> {
126126
Ref(Region<'tcx>, Ty<'tcx>, hir::Mutability),
127127

128128
/// The anonymous type of a function declaration/definition. Each
129-
/// function has a unique type.
129+
/// function has a unique type, which is output (for a function
130+
/// named `foo` returning an `i32`) as `fn() -> i32 {foo}`.
130131
///
131-
/// For example the type of `a` here:
132+
/// For example the type of `bar` here:
132133
///
133134
/// ```rust
134135
/// fn foo() -> i32 { 1 }
135-
///
136-
/// fn hello() {
137-
/// let a = foo;
138-
/// }
136+
/// let bar = foo; // bar: fn() -> i32 {foo}
139137
/// ```
140138
FnDef(DefId, &'tcx Substs<'tcx>),
141139

142140
/// A pointer to a function. Written as `fn() -> i32`.
143141
///
144-
/// For example the type of `a` here:
142+
/// For example the type of `bar` here:
145143
///
146144
/// ```rust
147145
/// fn foo() -> i32 { 1 }
148-
/// let a: fn() -> i32 = foo;
146+
/// let bar: fn() -> i32 = foo;
149147
/// ```
150148
FnPtr(PolyFnSig<'tcx>),
151149

0 commit comments

Comments
 (0)