micro doc fixes
This commit is contained in:
parent
fa89f53352
commit
ea447924ce
@ -100,19 +100,9 @@ impl<'tcx> ClosureKind {
|
||||
self <= other
|
||||
}
|
||||
|
||||
/// Returns the representative scalar type for this closure kind.
|
||||
/// See `Ty::to_opt_closure_kind` for more details.
|
||||
pub fn to_ty(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
|
||||
match self {
|
||||
ClosureKind::Fn => tcx.types.i8,
|
||||
ClosureKind::FnMut => tcx.types.i16,
|
||||
ClosureKind::FnOnce => tcx.types.i32,
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts `self` to a [`DefId`] of the corresponding trait.
|
||||
///
|
||||
/// Note: the inverse of this function is [`TyCtxt::fn_trait_kind_from_def_id`]
|
||||
/// Note: the inverse of this function is [`TyCtxt::fn_trait_kind_from_def_id`].
|
||||
pub fn to_def_id(&self, tcx: TyCtxt<'_>) -> DefId {
|
||||
tcx.require_lang_item(
|
||||
match self {
|
||||
@ -123,6 +113,16 @@ impl<'tcx> ClosureKind {
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns the representative scalar type for this closure kind.
|
||||
/// See `Ty::to_opt_closure_kind` for more details.
|
||||
pub fn to_ty(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
|
||||
match self {
|
||||
ClosureKind::Fn => tcx.types.i8,
|
||||
ClosureKind::FnMut => tcx.types.i16,
|
||||
ClosureKind::FnOnce => tcx.types.i32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A composite describing a `Place` that is captured by a closure.
|
||||
|
@ -2114,8 +2114,7 @@ impl<'tcx> Ty<'tcx> {
|
||||
/// parameter. This is kind of a phantom type, except that the
|
||||
/// most convenient thing for us to are the integral types. This
|
||||
/// function converts such a special type into the closure
|
||||
/// kind. To go the other way, use
|
||||
/// `tcx.closure_kind_ty(closure_kind)`.
|
||||
/// kind. To go the other way, use `closure_kind.to_ty(tcx)`.
|
||||
///
|
||||
/// Note that during type checking, we use an inference variable
|
||||
/// to represent the closure kind, because it has not yet been
|
||||
|
Loading…
x
Reference in New Issue
Block a user