@@ -99,26 +99,26 @@ impl<'tcx> ClosureKind {
99
99
self <= other
100
100
}
101
101
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
-
112
102
/// Converts `self` to a [`DefId`] of the corresponding trait.
113
103
///
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`].
115
105
pub fn to_def_id ( & self , tcx : TyCtxt < ' _ > ) -> DefId {
116
106
match self {
117
107
ClosureKind :: Fn => tcx. lang_items ( ) . fn_once_trait ( ) . unwrap ( ) ,
118
108
ClosureKind :: FnMut => tcx. lang_items ( ) . fn_mut_trait ( ) . unwrap ( ) ,
119
109
ClosureKind :: FnOnce => tcx. lang_items ( ) . fn_trait ( ) . unwrap ( ) ,
120
110
}
121
111
}
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
+ }
122
122
}
123
123
124
124
/// A composite describing a `Place` that is captured by a closure.
0 commit comments