Skip to content

Commit ea44792

Browse files
committed
micro doc fixes
1 parent fa89f53 commit ea44792

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

compiler/rustc_middle/src/ty/closure.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,9 @@ impl<'tcx> ClosureKind {
100100
self <= other
101101
}
102102

103-
/// Returns the representative scalar type for this closure kind.
104-
/// See `Ty::to_opt_closure_kind` for more details.
105-
pub fn to_ty(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
106-
match self {
107-
ClosureKind::Fn => tcx.types.i8,
108-
ClosureKind::FnMut => tcx.types.i16,
109-
ClosureKind::FnOnce => tcx.types.i32,
110-
}
111-
}
112-
113103
/// Converts `self` to a [`DefId`] of the corresponding trait.
114104
///
115-
/// Note: the inverse of this function is [`TyCtxt::fn_trait_kind_from_def_id`]
105+
/// Note: the inverse of this function is [`TyCtxt::fn_trait_kind_from_def_id`].
116106
pub fn to_def_id(&self, tcx: TyCtxt<'_>) -> DefId {
117107
tcx.require_lang_item(
118108
match self {
@@ -123,6 +113,16 @@ impl<'tcx> ClosureKind {
123113
None,
124114
)
125115
}
116+
117+
/// Returns the representative scalar type for this closure kind.
118+
/// See `Ty::to_opt_closure_kind` for more details.
119+
pub fn to_ty(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
120+
match self {
121+
ClosureKind::Fn => tcx.types.i8,
122+
ClosureKind::FnMut => tcx.types.i16,
123+
ClosureKind::FnOnce => tcx.types.i32,
124+
}
125+
}
126126
}
127127

128128
/// A composite describing a `Place` that is captured by a closure.

compiler/rustc_middle/src/ty/sty.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,8 +2114,7 @@ impl<'tcx> Ty<'tcx> {
21142114
/// parameter. This is kind of a phantom type, except that the
21152115
/// most convenient thing for us to are the integral types. This
21162116
/// function converts such a special type into the closure
2117-
/// kind. To go the other way, use
2118-
/// `tcx.closure_kind_ty(closure_kind)`.
2117+
/// kind. To go the other way, use `closure_kind.to_ty(tcx)`.
21192118
///
21202119
/// Note that during type checking, we use an inference variable
21212120
/// to represent the closure kind, because it has not yet been

0 commit comments

Comments
 (0)