Skip to content

Commit 3d407cc

Browse files
committed
micro doc fixes
1 parent e9f6db5 commit 3d407cc

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

compiler/rustc_middle/src/ty/closure.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -99,26 +99,26 @@ impl<'tcx> ClosureKind {
9999
self <= other
100100
}
101101

102-
/// Returns the representative scalar type for this closure kind.
103-
/// See `Ty::to_opt_closure_kind` for more details.
104-
pub fn to_ty(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
105-
match self {
106-
ClosureKind::Fn => tcx.types.i8,
107-
ClosureKind::FnMut => tcx.types.i16,
108-
ClosureKind::FnOnce => tcx.types.i32,
109-
}
110-
}
111-
112102
/// Converts `self` to a [`DefId`] of the corresponding trait.
113103
///
114-
/// Note: the inverse of this function is [`TyCtxt::fn_trait_kind_from_def_id`]
104+
/// Note: the inverse of this function is [`TyCtxt::fn_trait_kind_from_def_id`].
115105
pub fn to_def_id(&self, tcx: TyCtxt<'_>) -> DefId {
116106
match self {
117107
ClosureKind::Fn => tcx.lang_items().fn_once_trait().unwrap(),
118108
ClosureKind::FnMut => tcx.lang_items().fn_mut_trait().unwrap(),
119109
ClosureKind::FnOnce => tcx.lang_items().fn_trait().unwrap(),
120110
}
121111
}
112+
113+
/// Returns the representative scalar type for this closure kind.
114+
/// See `Ty::to_opt_closure_kind` for more details.
115+
pub fn to_ty(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
116+
match self {
117+
ClosureKind::Fn => tcx.types.i8,
118+
ClosureKind::FnMut => tcx.types.i16,
119+
ClosureKind::FnOnce => tcx.types.i32,
120+
}
121+
}
122122
}
123123

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

compiler/rustc_middle/src/ty/sty.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2130,8 +2130,7 @@ impl<'tcx> Ty<'tcx> {
21302130
/// parameter. This is kind of a phantom type, except that the
21312131
/// most convenient thing for us to are the integral types. This
21322132
/// function converts such a special type into the closure
2133-
/// kind. To go the other way, use
2134-
/// `tcx.closure_kind_ty(closure_kind)`.
2133+
/// kind. To go the other way, use `closure_kind.to_ty(tcx)`.
21352134
///
21362135
/// Note that during type checking, we use an inference variable
21372136
/// to represent the closure kind, because it has not yet been

0 commit comments

Comments
 (0)